Monday, January 1, 2007

KVM on Edgy

One of the requirements when i bought my new laptop was that it should have a CPU with support for virtualization in the CPU. I have since last summer been running Xen on my server using para-virtualization. It works nice and give me the possibility to separate external web and mail server from internal infrastruktur services like DNS, DHCP, and NFS. The lack of para-virtualization is that you need a special kernel and preferably a special glibc. When using virtualization support in hardware, you get rid of this drawback.
Recently another player entered the main kernel stage, KVM. KVM is built on qemu and Bosch that have been around for years. A nice thing with KVM is that normal users can get the rights to run their own virtual machines as their own user, not sudo to root. A quick search on Google gave me a nice howto. One thing has changed since Alan wrote his howto. The latest version at the time of writing is 0.8. Instead of just insert one kernel module (kvm.ko) you had to insert two. First kvm.ko and then one depending if you have an Intel (kvm-intel.ko) or AMD (kvm-amd.ko) CPU. In my case it's a AMD CPU so I did:
sudo insmod kernel/kvm.ko

After this I downloaded the latest Ubuntu iso and created a harddisk:
qemu-img create -f qcow edgy.qcow 4G
Then boot from the CD to install (I use sudo since I have not fixed the user privilegies on the /dev/kvm-device):
sudo qemu -cdrom ubuntu-6.10-desktop-i386.iso -hda edgy.qcow -boot d -m 256
I recommend to run the liveCD with 256meg of ram, otherwise it will be incredible slow. When the installation is finished, shut it down and boot from the hard disk with:
sudo qemu -hda edgy.qcow -m 256

I have earlier been running VMWare Workstation and VMWare ESX-server. But I must say KVM is a much nicer experience when inside a virtual machine and it is much easier to set up than Xen. Perfect for my laptop.

No comments: