QEMU and KQEMU
I recently presented KVM as an efficient virtualization solution for PC's with VMX-enabled processors. Today I present another efficient solution for older processors.
QEMU is a well-known full system emulator, powerful enough to virtualize complete hardware systems. Its major drawback is that it actually emulates the processor, making it unefficient for virtualization purposes when performance is required. The KQEMU kernel module allows QEMU to use the host processor when running on a PC and emulating a PC, removing that performance barrier.
You need to compile the kqemu kernel module from the sources. Furtunately, Debian provides the module-assistant tool to do this in a very straightforward way.
As root, install the required tools with the command:
apt-get install qemu module-assistant
Then, to compile and install the kqemu module, issue the command:
module-assistant auto-install kqemu
Load the kqemu module:
Finally, let the system load the kqemu module at system startup using the command:
echo kqemu >> /etc/modules
That's all, your qemu setup is ready.
Invoking the virtual system
Invoking QEMU using the kqemu extension can be done with the command:
qemu -kernel-kqemu diskimage.img
The options for qemu are exactly the same as those employed by KVM. This is due to the fact that the KVM project used large parts of the QEMU system emulation code. So, if you want to perform a fresh Debian installation on a QEMU/KQEMU virtual system, using 512 megabytes of RAM, simply issue the commands:
qemu-img create -f qcow2 debian.qcow2 10G
qemu -kernel-kqemu -m 512 -cdrom debian-501-i386-netinst.iso debian.qcow2
You may run a virtual system, connecting the LAN card to the tap0 virtual network:
qemu -kernel-kqemu -m 512 -net nic -net tap,ifname=tap0,script=no,downscript=no debian.qcow2
In a more general way, as the virtual system behaves the same way as a KVM virtual system, you may use it for the exact same purpose. For instance, the installation of a virtual server I recently described using KVM can be done in the exactly same way.
I have explained how to setup a virtual system on computers without requiring the processor vmx extensions. The virtual system may not be as fast as it would be on a KVM-based setup, but it is very usable.