Creating Virtual Machines with QEMU

Create a Disk Image

Make an OS image with the qcow2 format, which is the native format that QEMU uses to run virtual machines:

qemu-img create -f qcow2 <MACHINE_NAME>.img 10G

Run the Installation

This is for running the installation:

qemu-system-x86_64 -enable-kvm -cdrom <ISO_FILE>.iso -boot menu=on -drive file=image.img -m 2G -cpu host -smp 2 -vga virtio -display gtk,gl=on

Explanation of Options

To enable -vga qxl, load the required modules:

sudo modprobe qxl bochs_drm

I recommend using virtio. You may also choose the display option with:

After Installation

Once the ISO installation is complete, remove the option -cdrom <ISO_FILE>.iso:

qemu-system-x86_64 -enable-kvm -boot menu=on -drive file=image.img -m 2G -cpu host -smp 2 -vga virtio -display gtk,gl=on

Useful Shortcuts