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.
Trackbacks are closed.