QEMU in five minutes

Some friends have been asking me how to use QEMU. While there are many other virtualization packages (such as Virtual Box, KVM or the non-free VMware Player), QEMU has been around for a while, it’s already packaged in Debian stable and it’s really easy to use.

Moreover, the (optional) kernel accelerator kqemu has been released under the GPL a couple of months ago, so it’s a good moment to give QEMU a try.

Let’s see the basic usage:

  • Install QEMU.
    $ apt-get install qemu
  • Create a hard disk image. It’s 2 GB in this example, but don’t worry about the size of the file, it will grow dinamically as you write data to it.
    $ qemu-img create -f qcow hd.img 2G
  • Install things in your new hard disk image. You can boot from a CD-ROM, or an ISO image, a floppy…
    $ qemu -hda hd.img -cdrom /dev/cdrom -boot d
    $ qemu -hda hd.img -cdrom cdimage.iso -boot d
    $ qemu -hda hd.img -fda /dev/fd0 -boot a
    $ qemu -hda hd.img -fda floppy.img -boot a
  • Once the system is installed in your virtual hard disk, you can boot directly from it:
    $ qemu -hda hd.img
  • Or you can forget about hard disks and just use a bootable CD:
    $ qemu -cdrom livecd.iso

And that’s it! QEMU has built-in SMB, TFTP, DNS and DHCP servers. Everything in user space, so you don’t need special permissions nor additional configuration: no kernel modules, no tun/tap interfaces… nothing!. I said it was very easy to use, didn’t I? πŸ˜‰

Of course there’s a lot more, but you won’t need it for the basic usage.

If you’re too lazy to install an operating system inside QEMU, you can download a hard disk image built by someone else. Note that QEMU can read the VMware disk format, so you’ve got a really big collection of images ready to work.

And if you want a bit more, you can compile the kqemu kernel accelerator, which will make QEMU run faster.

Now I can remember the old times when I first installed Debian…
Debian bo inside QEMU

2 thoughts on “QEMU in five minutes

  1. Suso

    It’s really good that kqemu has been released as GPL, it’s now a complete opensource solution for virtualizing servers. But I don’t think it’s yet ready for a desktop operating system, because the video card emulation is rather slow. I hope it gets better in the future.

    Reply
  2. berto

    I haven’t made any test with graphic intensive applications but, as you say, I guess that they don’t work well. Γ‰che o que hai

    At least it’s not what I need right now from this kind of software.

    Thanks for your comment, Suso! πŸ™‚

    Reply

Leave a Reply to berto Cancel reply

Your email address will not be published. Required fields are marked *