QEMU: a Multihost, Multitarget Emulator

QEMU comes to the rescue for those times when VMware is overkill.
Installing QEMU

To install QEMU, download the source package from the main QEMU Web site (see Resources) and the binary kqemu package. There is also a binary QEMU package available. If you download and install the binary, you will not be able to use KQEMU, because it needs to be compiled into QEMU to work. KQEMU, unlike QEMU, is available only as a binary package. It is not open source. See the KQEMU sidebar for more information. At the time of this writing, QEMU is at version 0.8.0, and KQEMU is at version 0.7.2. Because they are under active development, there may be updated versions available by the time you read this.

Once I had downloaded the two packages, I first untarred QEMU with:


tar -zxvf qemu-0.8.0.tar.gz

Next, I changed directories into the qemu-0.8.0 directory I had just created and did:


tar -zxvf ../path/to/kqemu-0.7.2.tar.gz

This created a kqemu directory inside of my qemu-0.8.0 directory.

When I compile applications from source, a ./configure, make, make install at this point is usually all that I need to do to get a piece of software installed. QEMU needed a bit more hand holding.

In order to have QEMU compile successfully on my machine, I had to make a few changes to the configure script. The changes themselves were quite simple. First, QEMU does not get along with 4.x versions of gcc, so I had to change the cc= and host_cc= lines to use gcc-3.4 specifically. Then, I had to change kqemu="no" to kqemu="yes". Finally, it was necessary to enter the path to my kernel source tree in kernel_path="". One note: QEMU uses SDL for output, so although I did not need to install anything extra for my particular setup, others may have to install some SDL libraries before the configure script will be happy.

Once I was able to run ./configure without it complaining, I ran make and then make install to install QEMU to my /usr/local/ directory. To install the KQEMU accelerator kernel module, I typed the following into an open terminal:


modprobe kqemu

Using an Existing Image

Once I had installed QEMU, I wanted to see it in action. The easiest way to try it out was to boot a live CD ISO image like KNOPPIX, Ubuntu, SimplyMepis, DSL, Puppy or one of the scores of others. To boot QEMU off a bootable CD image, I simply entered the following at the command line:


qemu -boot d -cdrom path/to/distro.iso

The -boot d parameter tells QEMU to boot from the CD drive, and -cdrom path/to/distro.iso tells QEMU where the CD-ROM “drive” is, which in this example, is simply an ISO image. I also could have pointed QEMU at my actual CD-ROM drive—/dev/cdrom—and when I installed Windows, that is what I did.

Figure 1. QEMU Running the KNOPPIX Live CD

Creating an Image and Installing an OS

Before I could install an operating system, I first needed to prepare a virtual hard disk in which to install. QEMU understands various disk image formats, including VMware's vmdk, which would have come in handy if I had some of them lying around. As it turned out, the default, “raw” format worked well. A raw format disk image acts like an unformatted hard drive, which was perfect for my needs.

I used the following command to create an image named winxp.img, 5GB in size, which I figured was big enough to install Windows XP and Outlook and give me plenty of e-mail storage:


qemu-img create winxp.img 5120M

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

qvm86 is officially (?) obsolete

Geraldo's picture

From qvm86's project site on Savannah a post from the admin:

-- BEING POST --
qvm86 is obsolete
posted by pbrook, Sunday 01/21/07 at 16:16 UTC - 4 replies

InnoTek have released their VirtualBox code under the GPL.
As far as I'm concerned this obsoletes qvm86, and I see no point continuing development. I recommend anyone interested in qvm86 use VirtualBox ...
-- END POST --

QEMU is alive

Gabriel Menini's picture

Actually, QEMU and VirtualBox are different products.

VirtualBox has a very nice GUI and is available both for Linux and Windows.

On the other hande, I find using QEMU very simple ;-)

BTW, great magazine article.

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix