Monday, June 18, 2007

Qemu with Debian Etch

Recently, I wrote something about installing VMware server on Ubuntu Edgy, which should basically work with Debian's Etch, too. There is an alternative to VMware: Qemu. This peace of software also emulates a complete PC hardware and is opensource. To make Qemu faster it comes with a kernel module called "kqemu" which is free but distributed under a proprietary license until version 1.3.0pre9 - and this is the version Etch ships with. You may download the latest software from here, but I installed the default Debian packages and therefor I'll write about this kind of installation.

As the "kqemu" module is available as source only, we need to compile it. So, better have the kernel headers installed! Assuming you're running a default Etch kernel image (in my case amd64), get everything installed with (as root):
apt-get install kernel-headers-2.6.18-4-amd64 build-essential

To figure out your kernel version:
uname -r

Now install qemu:
apt-get install qemu qemu-launcher qemuctl kqemu-common kqemu-source

To get the kqemu kernel module installed, we also need
apt-get install module-assistant

To actually compile and install the module type
m-a update

m-a a-i kqemu

Load the module via
modprobe kqemu

If you like to load it automatically at boot
echo "kqemu" >> /etc/modules

OK, so far, so good: Qemu is installed. Basically Qemu is command line driven, but if you followed my instructions so far you should have installed "qemu-launcher". You'll find a shortcut in the KDE menu or simply type (don't need to be root!): qemu-launcher. I guess it's rather self explaining. In the "Configuration -> Emulator" tab you'll find the settings for the kqemu module (which of course only works if the module is loaded!): leave it then at "Enabled". To test Qemu I enabled "Use CD-Rom", set RAM to "1024MB", inserted the path to an Ubuntu Egdy CD image and booted it in the virtual machine. I guess it took about 10 minutes to boot to Ubuntu's desktop - but it worked! Network didn't though, but I might do some more tweaking in qemu-launcher to make it work.


Windows 98/2000/XP should also work. As I read in a recent issue of "Linux User" magazine you may need to add a "-no-acpi" option to get Windows 98 running. I didn't find such an option in qemu-launcher, but the command line helps us out here:
qemu -cdrom /dev/cdrom -boot d -m 512 -hda /path/to/dsk.img -no-acpi

OK, what does the above command do?
-cdrom /dev/cdrom - this activates the local CD-Rom drive
-boot -d - boot from CD-Rom drive
-m 512 - expand RAM to 512MB
-hda /path/to/dsk.img - use "dsk.img" as harddisk

You may create a disk image file for Qemu to use as virtual harddisk via:
qemu-img create /path/to/dsk.img 10G

This will create a 10GB image.

I have to say, that Qemu - at least with my Ubuntu Edgy test image - is rather slow compared to VMware server. But it's opensource (at least the latest version...) and if you like to take a short glimpse at different operating systems it should be sufficient.

No comments:

Post a Comment