You are here
I helped a friend this weekend to install the WordPress Appliance on a server with KVM.
Here is my "Recipe":
1. Download the VMDK-file and Unzip it
2. Convert the Vmware-image to QEMU Raw-format with:
qemu-img convert turnkey-wordpress-2009.10-2-hardy-x86.vmdk sda.img
3. Mount the image temporary:
If you look att Disk-image with "fdisk -ul sda.img" you see that "sda1" starts at unit 32 and that an unit is 512 bytes (32x512=16384). Mount it like this:
mount -o loop,offset=16384 sda.img /mnt
4. Create support for Serial Console:
In /mnt/etc/grub/menu.lst add the following in the top:
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1 terminal --timeout=15 serial console
Change the kernel-lines in the end to look like:
kernel /boot/vmlinuz-2.6.2..... ro quiet splash console=tty0 console=ttyS0,115200n8
Create /mnt/etc/event.d/ttyS0 with following content:
# ttyS0 - getty # # This service maintains a getty on tty1 from the point the system is # started until it is shut down again. start on stopped rc2 start on stopped rc3 start on stopped rc4 start on stopped rc5 stop on runlevel 0 stop on runlevel 1 stop on runlevel 6 respawn exec /sbin/getty 115200 ttyS0
5. Set static IP:
Edit /mnt/etc/network/interfaces to look like this:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 1.2.3.4 netmask 255.255.255.0 gateway 1.2.3.1
6. Setup DNS:
Edit /mnt/etc/resolvconf/resolv.conf.d/base to look like this:
domain yourdomain.com search yourdomain.com nameserver 208.67.222.222 nameserver 208.67.220.220
7. Unmount the Image:
umount /mnt
8. Create an XML-file for KVM:
I modified an existing file and got this (wp.xml):
<domain type='qemu' id='2'> <name>wp</name> <memory>524288</memory> <currentMemory>524288</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86' machine='pc'>hvm</type> <boot dev='hd'/> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <source file='/srv/virt/wp/sda.img'/> <target dev='hda' bus='virtio'/> </disk> <interface type='bridge'> <mac address='52:54:00:aa:12:34'/> <source bridge='br0'/> <target dev='vnet2'/> <model type='virtio'/> </interface> <serial type='pty'> <source path='/dev/pts/3'/> <target port='0'/> </serial> <console type='pty' tty='/dev/pts/3'> <source path='/dev/pts/3'/> <target port='0'/> </console> </devices> </domain>
Don't forget that mac address must be unique.
9. Define it in KVM and make it autostart with help of virsh:
Start virsh and type:
define wp.xml autostart wp
Start up your new virtual machine with virsh and play with it...
start wp console wp
That's all folks!
No comments!?
Was everything clear or was it ununderstandable?
One thing to change if you have newer libvirt/kvm running is to have "kvm" instead of "qemu" in the first line of the xml-file with the machine definition. "kvm" gives hardware acceleration and "qemu" not!
And to get swap to work and use kvm's virtual driver for disk change /etc/fstab to:
Maybe upcoming 10.04 based turnkeys could have Serial Console included by default?
10.04 have ttyS0 defined in /etc/init/ttyS0.conf (instead of /etc/event.d/ttyS0) with content like:
See: http://help.ubuntu.com/community/SerialConsoleHowto
One more tip: If you upgrade your Ubuntu/KVM server to 10.04, you need to load the kernal kvm-modules (kvm and kvm-amd or kvm-intel), ie put them in /etc/modules which earlier versions not needed.
/Claes
(I spent a whole day after my upgrade to 10.04 to get everything to work again...)
This could be a great addition to the community documentation
Oh and sorry for the lag in response time, we're working on launching the TurnKey Hub private beta as well as coming out with betas of the Lucid based appliances. That's been keeping us unusually busy...
Community doc..
After and if Tkl based on some newer platform than 8.04 been released, then I going to try write up this doc.
/Claes
What is your the respons of...
ls -al /srv/vm/templates/images/turnkey/turnkey-zimbra-2009.10-2-hardy-x86/turnkey-zimbra-2009.10-2-hardy-x86.vmdk.img
Are you able to mount the image again after your modifications?
What platform and versions are you on?
Could you test to move your image-map "nearer" root (shorter paths) and see if it work (may some maxlength of parameter strings to kvm/qemu)
You have not changed the domain type to kvm in the xml-file, or have you?
/Claes
Maybe it is a problem with rights?
try
Add new comment