Source

kschiess.bitbucket.org / qemu-toolkit / qemu-toolkit-install.7.html

Full commit
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv='content-type' value='text/html;charset=utf8'>
  <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
  <title>qemu-toolkit-install(7) - installations instructions for the qemu-toolkit</title>
  <style type='text/css' media='all'>
  /* style: man */
  body#manpage {margin:0}
  .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
  .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
  .mp h2 {margin:10px 0 0 0}
  .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
  .mp h3 {margin:0 0 0 4ex}
  .mp dt {margin:0;clear:left}
  .mp dt.flush {float:left;width:8ex}
  .mp dd {margin:0 0 0 9ex}
  .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
  .mp pre {margin-bottom:20px}
  .mp pre+h2,.mp pre+h3 {margin-top:22px}
  .mp h2+pre,.mp h3+pre {margin-top:5px}
  .mp img {display:block;margin:auto}
  .mp h1.man-title {display:none}
  .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
  .mp h2 {font-size:16px;line-height:1.25}
  .mp h1 {font-size:20px;line-height:2}
  .mp {text-align:justify;background:#fff}
  .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
  .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
  .mp u {text-decoration:underline}
  .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
  .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
  .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
  .mp b.man-ref {font-weight:normal;color:#434241}
  .mp pre {padding:0 4ex}
  .mp pre code {font-weight:normal;color:#434241}
  .mp h2+pre,h3+pre {padding-left:0}
  ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
  ol.man-decor {width:100%}
  ol.man-decor li.tl {text-align:left}
  ol.man-decor li.tc {text-align:center;letter-spacing:4px}
  ol.man-decor li.tr {text-align:right;float:right}
  </style>
  <style type='text/css' media='all'>
  /* style: toc */
  .man-navigation {display:block !important;position:fixed;top:0;left:113ex;height:100%;width:100%;padding:48px 0 0 0;border-left:1px solid #dbdbdb;background:#eee}
  .man-navigation a,.man-navigation a:hover,.man-navigation a:link,.man-navigation a:visited {display:block;margin:0;padding:5px 2px 5px 30px;color:#999;text-decoration:none}
  .man-navigation a:hover {color:#111;text-decoration:underline}
  </style>
</head>
<!--
  The following styles are deprecated and will be removed at some point:
  div#man, div#man ol.man, div#man ol.head, div#man ol.man.

  The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
  .man-navigation should be used instead.
-->
<body id='manpage'>
  <div class='mp' id='man'>

  <div class='man-navigation' style='display:none'>
    <a href="#NAME">NAME</a>
    <a href="#PREREQUISITES">PREREQUISITES</a>
    <a href="#INSTALLATION">INSTALLATION</a>
    <a href="#FIRST-STEPS">FIRST STEPS</a>
    <a href="#SEE-ALSO">SEE ALSO</a>
  </div>

  <ol class='man-decor man-head man head'>
    <li class='tl'>qemu-toolkit-install(7)</li>
    <li class='tc'>qemu-toolkit</li>
    <li class='tr'>qemu-toolkit-install(7)</li>
  </ol>

  <h2 id="NAME">NAME</h2>
<p class="man-name">
  <code>qemu-toolkit-install</code> - <span class="man-whatis">installations instructions for the qemu-toolkit</span>
</p>

<h2 id="PREREQUISITES">PREREQUISITES</h2>

<p>For this to run, you need at least one physical host running
<a href="http://omnios.omniti.com/">OmniOS</a> or another
<a href="https://en.wikipedia.org/wiki/Illumos">Illumos</a>-based distro. The host needs
to support VT/x extensions to be able to run KVM-based virtualisation. Also,
some basic working knowledge of Illumos is of help.</p>

<h2 id="INSTALLATION">INSTALLATION</h2>

<p>These instructions assume that you install on a clean OmniOS machine. If you
use another distribution, your mileage may vary. If you have first-hand
experience on other distributions of Illumos, we'd be interested to hear from
you!</p>

<h3 id="RVM-Ruby">RVM &amp; Ruby</h3>

<p>Install packages needed to build Ruby:</p>

<pre><code>pkg install git autoconf gnu-m4 gnu-make gcc-3 gnu-patch \
lint system/header header-math gnu-coreutils readline \
gnu-binutils gnu-tar developer/linker
</code></pre>

<p>Then make sure that you have <code>/usr/sfw/bin</code> in your PATH and that your
linker is functional.</p>

<p>Install YAML:</p>

<pre><code>wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=/usr
make 
make install
</code></pre>

<p>Then Ruby (via RVM):</p>

<pre><code>curl -L https://get.rvm.io | bash -s stable --ruby
</code></pre>

<p>Please see the RVM <a href="https://rvm.io/">website</a> for more information.</p>

<h3 id="-socat-">'socat'</h3>

<p>socat is a tool that connects different types of sockets together. The
qemu-toolkit toolchain uses it to make VNC and VM monitor available.</p>

<pre><code>wget --no-check-certificate http://bit.ly/TwNMrJ -O socat-1.7.1.3.tar.gz
tar xzvf socat-1.7.1.3.tar.gz
cd socat-1.7.1.3
# PATCH for this to work: cat patch.txt | patch
./configure
make
make install
</code></pre>

<p>Note that the above installation only succeeds if you patch socat using this
patch:</p>

<pre><code>--- sysincludes.h.orig  2012-09-03 16:59:09.351904279 +0000
+++ sysincludes.h       2012-09-03 16:59:54.388720160 +0000
@@ -131,6 +131,8 @@
 #include &lt;netpacket/packet.h&gt;
 #endif
 #if HAVE_NETINET_IF_ETHER_H
+#include &lt;net/if.h&gt;
+#include &lt;netinet/in.h&gt;
 #include &lt;netinet/if_ether.h&gt;
 #endif
 #if HAVE_LINUX_IF_TUN_H
</code></pre>

<h3 id="iSCSI-target">iSCSI target</h3>

<p>If you want to use the machine as iSCSI target (as a storage provider), you'll
need to do at least this:</p>

<pre><code>pkg install network/iscsi/target
svcadm enable -r svc:/network/iscsi/target:default
</code></pre>

<p>The tools expect a target portal group named <code>frontend</code>. To create it, use
something like the following command, where <var>IP</var> must be an TCP/IP address
of the host you're doing this for:</p>

<pre><code>itadm create-tpg frontend IP
</code></pre>

<h3 id="QEMU-KVM">QEMU / KVM</h3>

<p>For qemu to work properly, you must make sure that you have at least as much
swap space as you have RAM. Default configuration only gives you 4GB of swap.
To fix this, do something like the following: (assumes that you've got 30GB of
RAM)</p>

<pre><code>zfs set volsize=30G rpool/swap
</code></pre>

<p>Also, perhaps obviously, you will need to load the kvm kernel driver. This is
accomplished by</p>

<pre><code>add_drv kvm
</code></pre>

<p>You will want to reboot the machine after these two steps for two reasons:
Sometimes loading <code>kvm</code> interferes with reboot behaviour, you'll want to know
that before you continue. And swap resizing takes effect on reboot only.</p>

<h3 id="qemu-toolkit">qemu-toolkit</h3>

<p>Once you've done all this, you're ready to install <code>qemu-toolkit</code>. Simply:</p>

<pre><code>gem install qemu-toolkit
</code></pre>

<p>You should now have <code>vmadm</code> and <code>storadm</code> in your path.</p>

<h2 id="FIRST-STEPS">FIRST STEPS</h2>

<p>Create a block device for your virtual machine. Assuming you want to create
it on <var>POOL</var>:</p>

<pre><code>storadm create POOL/myvm 10G
</code></pre>

<p>This should create a dataset called <var>POOL</var><code>/myvm</code> and a subordinate zvol
called 'disk1'. Let's connect a virtual machine to that disk:</p>

<pre><code>vmadm create myvm
</code></pre>

<p>This will create a configuration file called <code>/etc/qemu-toolkit/myvm.rb</code>.
Feel free to edit this. Once you've customized it to your liking, start the
virtual machine and boot from an <var>ISO</var> image:</p>

<pre><code>vmadm start myvm --bootiso=ISO
</code></pre>

<p>If you're interested in configuring your virtual machine (qemu), please see
<a class="man-ref" href="qemu-toolkit-configuration.7.html">qemu-toolkit-configuration<span class="s">(7)</span></a>.</p>

<h2 id="SEE-ALSO">SEE ALSO</h2>

<p><a class="man-ref" href="qemu-toolkit-overview.7.html">qemu-toolkit-overview<span class="s">(7)</span></a>, <a class="man-ref" href="qemu-toolkit-install.7.html">qemu-toolkit-install<span class="s">(7)</span></a>,
<a class="man-ref" href="qemu-toolkit-configuration.7.html">qemu-toolkit-configuration<span class="s">(7)</span></a>, <a class="man-ref" href="storadm.1.html">storadm<span class="s">(1)</span></a>, <a class="man-ref" href="vmadm.1.html">vmadm<span class="s">(1)</span></a>, <a class="man-ref" href="README.7.html">README<span class="s">(7)</span></a></p>


  <ol class='man-decor man-foot man foot'>
    <li class='tl'></li>
    <li class='tc'>November 2012</li>
    <li class='tr'>qemu-toolkit-install(7)</li>
  </ol>

  </div>
</body>
</html>