Something we do have a wide choice of in Ubuntu Linux (and on many other Linux platforms) is virtualisation software. Previously in this blog I've covered VirtualBox, which was recently acquired by Sun Microsystems. A new version of this software is out, but unfortunately the download repositories have been disabled and the downloads moved to an old fashioned manual download and install model thanks to "U.S. export regulations". I hope Sun sort this out soon. Another option though has been quietly developing and as available in (K)Ubuntu 8.10. The Kernel-based Virtual Machine is an an open source option to run virtual machines on your computer which can benefit from hardware acceleration many many modern CPUs to achieve near-native speeds for the guest images. The user friendliness of this software has been greatly improved through the addition of Virt-Manager, a GUI front end for KVM which means that you don't have to use the command line anymore to set up, monitor and run your virtual machines. I took this software out for a test drive by making a virtual machine that can run Ubuntu 8.04 (32 bit) on my Kubuntu 8.04 (64 bit) system, you could of course also have Microsoft Windows as a guest, the software emulates an entire machine.
To see if your computer can perform hardware acceleration for KVM try this on a command line:
egrep '(vmx|svm)' /proc/cpuinfo
If you see an output you are in luck, if not you might want to have a look at Qemu. The definitive reference to running KVM and virt-manager is at: https://help.ubuntu.com/community/KVM (the amount of documentation available for Ubuntu is definitely one of its strong points) and I found a nice walk though of Virt-Manager at: http://www.phoronix.com/scan.php?page=article&item=983&num=1. The first thing to do is to install the software, fortunately it is all in the Ubuntu repositories, so can all be installed easily with apt-get:
sudo apt-get install kvm libvirt-bin virt-manager virt-viewer
It is splitup into several packages so that is possible to have many different configurations, for example you wouldn't install the GUI if you were installing the KVM software on a remote server. The next thing to do is to add yourselves to a couple of groups to get the necessary permissions to use hardware acceleration to do this enter the following commands (the "id -un" part returns the current user name):
sudo adduser `id -un` libvirtd
sudo adduser `id -un` kvm
At this point you should log out and in of Kubuntu to get it to pick up the new permissions (you don't need to reboot). Now launch the Virtual Machine Manager (on my KDE4 Remix machine it was under K -> Applications -> System -> Virtual Machine Manager) and connect your virtual machine host (localhost).
You can now set up a virtual machine by clicking on "New" and following the wizard.
The wizard asks the usual questions for setting up a virtual machine such as the operating system type, hard disk image size and so on. One question it asked that I was less familiar with was an option over the type of virtualisation to perform, fully virtualised or paravirtualised. Only fully virtualised was available for me though. When you are running or installing onto a virtual machine you can see its screen through the Virtual Machine Console. Note though that if you close this window the virtual machine will still keep running in the background and you can get the screen back by clicking on the entry in Virt-Manager. Installing Ubuntu went smoothly:
One thing I did notice was that when Ubuntu was fully installed I could pass my mouse over the guest machine window, interact with it and then move outside that window without having to press any key to release the mouse back to the host. This happened automatically without the need to install anything extra on the guest. It all seemed to work well and the speed was very good. You can also get real time graphs of the CPU and memory resources used by the virtual machine as you use it, which is a nice touch.
KVM and Virt-Manager will no doubt be technologies to watch, and it is great to see just how far open source virtualisation technology has come over the last couple of years.
Re: Virtualisation with KVM and Virt-Manager on (K)Ubuntu 8.04
Hey, in your list of packages to install, you misspelled libvirt-bin. It should be an i, not an e (libvert-bin is what you have). Thanks for the guide =).
Re: Virtualisation with KVM and Virt-Manager on (K)Ubuntu 8.04
Whoops! Thanks for spotting my typo wolf08, I've corrected that now.
Thanks for the great tutorial
I've just gone through what you've written here and I've managed to get Windows XP up and running on my Ubuntu Server 11.04 box with relative ease :)