QEMU/Installing QEMU

From Wikibooks, the open-content textbooks collection

< QEMU
Jump to: navigation, search

[edit] Installing QEMU

Many modern Linux distros have simple installation processes based on package repositories. It is often best to use the repository approach for installing QEMU, as you can be confident that QEMU will just install and run. Here are some common Linux distros and their QEMU install commands:

Distribution Install command
Fedora / Red Hat etc. yum install qemu
Debian - Ubuntu, Mepis, etc. apt-get install qemu
SUSE yast -i qemu

If you can't install QEMU from a package repository, go to the QEMU website and download the latest binary distribution and follow the instructions given.

For Microsoft Windows, you can install a GUI-front end to QEMU called QEMU Manager.

[edit] QEMU from source

You might need or prefer to install QEMU by compiling the source code, which is available on the QEMU website. The QEMU website has basic instructions on how to compile the source code on Linux and Microsoft Windows.

[edit] Installing kqemu

QEMU by itself isn't very fast, as it does a lot of emulation even when running on the hardware compatible with the guest operating system. To make it perform better, QEMU has a kernel module called kqemu that allows much of the guest OS's code to run directly on the host processor when running on x86 or x86-64 processors under Linux. For example, if the host is x86 Linux and the guest is Windows XP, then kqemu can run most of the Windows XP code directly on the processor without emulation.

There are pre-built packages of kqemu that can be downloaded for some Linux distros, however it is likely that they will be out of date when a new kernel revision is released so it is generally better to build kqemu from source, and rebuild it again every time you install a new revision of the kernel. You can download the kqemu sources from the QEMU website download page.

After extracting the source to a folder, build and install the kernel module. This is the procedure you will need to repeat after updating to a new kernel.

make clean
./configure
make
su
make install
exit

Once built and installed, you will need to tell your Linux distro to use the module. The QEMU website tells you how to do this in different situations, but a simple way is to add the following to your /etc/rc.d/rc.local script:

/sbin/modprobe kqemu
sleep 1
chmod a+rw /dev/kqemu
echo 1024 > /proc/sys/dev/rtc/max-user-freq

To make use of kqemu, add this to your qemu command: -kernel-kqemu