QEMU: The Quick EMUlator is really quick
Introduction
This post is about setting up qemu
on Windows 10 and running Ubuntu on it. Just to show that there is another alternative beside virtualbox and vmware player. Even though KVM doesn’t work on windows it is still a solid alternative.
Installation
To install download the 64-bit binaries for windows. It’s way less hectic than compiling your own from the source, and I didn’t even attempt to do that. Add the installed location C:\Program Files\qemu
to the windows path.
Test Run
Once installation and path setting is done try to run qemu-system-x86_64.exe
from cmd
. You will see that qemu ultimately fails, complaining that there is no bootable image. So let’s get that bootable media for qemu.
Ubuntu 20.04
Get the desktop image from Ubuntu website
HDD
Create the hard disk image for qemu in a format it understands and get it ready for Ubuntu installation.
qemu-img create -f qcow2 ubuntu-desktop.img.qcow2 50G
#[Output] Formatting 'ubuntu-desktop.img', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=32212254720 lazy_refcounts=off refcount_bits=16
Installation
To install Ubuntu, run qemu
by setting the formatted file as HDD and the downloaded ISO
as cdrom
. Once you run this command the same window will appear and this time it’ll find a bootable media, the cdrom
. If the window goes black, try again and this time click inside and press enter.
qemu-system-x86_64 -hda ubuntu-desktop.img.qcow2 -m 4G -net nic -net user -cdrom ubuntu-20.04.2.0-desktop-amd64.iso -accel whpx
Once installation is done, power off the machine instead of restart.
Ubuntu Run
Now, run the qemu
without anything in the cdrom
qemu-system-x86_64 -hda ubuntu-desktop.img.qcow2 -m 4G -net user -net nic -accel whpx
Once system boot is done, try to open firefox and access some website.
PS
- To know more about
accel
option, specifically on window: https://www.qemu.org/2017/11/22/haxm-usage-windows/ - There are two
-net
options in the command, one creates the NIC and other tells the qemu to use user mode networking.