qemu-toolkit-install
- installations instructions for the qemu-toolkit
For this to run, you need at least one physical host running OmniOS or another Illumos-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.
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!
Install packages needed to build Ruby:
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
Then make sure that you have /usr/sfw/bin
in your PATH and that your
linker is functional.
Install YAML:
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
Then Ruby (via RVM):
curl -L https://get.rvm.io | bash -s stable --ruby
Please see the RVM website for more information.
socat is a tool that connects different types of sockets together. The qemu-toolkit toolchain uses it to make VNC and VM monitor available.
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
Note that the above installation only succeeds if you patch socat using this patch:
--- 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 <netpacket/packet.h>
#endif
#if HAVE_NETINET_IF_ETHER_H
+#include <net/if.h>
+#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#if HAVE_LINUX_IF_TUN_H
If you want to use the machine as iSCSI target (as a storage provider), you'll need to do at least this:
pkg install network/iscsi/target
svcadm enable -r svc:/network/iscsi/target:default
The tools expect a target portal group named frontend
. To create it, use
something like the following command, where IP must be an TCP/IP address
of the host you're doing this for:
itadm create-tpg frontend IP
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)
zfs set volsize=30G rpool/swap
Also, perhaps obviously, you will need to load the kvm kernel driver. This is accomplished by
add_drv kvm
You will want to reboot the machine after these two steps for two reasons:
Sometimes loading kvm
interferes with reboot behaviour, you'll want to know
that before you continue. And swap resizing takes effect on reboot only.
Once you've done all this, you're ready to install qemu-toolkit
. Simply:
gem install qemu-toolkit
You should now have vmadm
and storadm
in your path.
Create a block device for your virtual machine. Assuming you want to create it on POOL:
storadm create POOL/myvm 10G
This should create a dataset called POOL/myvm
and a subordinate zvol
called 'disk1'. Let's connect a virtual machine to that disk:
vmadm create myvm
This will create a configuration file called /etc/qemu-toolkit/myvm.rb
.
Feel free to edit this. Once you've customized it to your liking, start the
virtual machine and boot from an ISO image:
vmadm start myvm --bootiso=ISO
If you're interested in configuring your virtual machine (qemu), please see qemu-toolkit-configuration(7).
qemu-toolkit-overview(7), qemu-toolkit-install(7), qemu-toolkit-configuration(7), storadm(1), vmadm(1), README(7)