home | whoami

QEMU cheatsheet

tags: linux, qemu, vm, virtualization

Create disk image

Creates 3 GB large image named centos-7.img:

qemu-img create -f qcow2 centos-7.img 3G

Format qcow2 supports compression.

Run VM

Run Centos VM using image centos-7.img, allocate 1024 MB ram, boot from CD-ROM using CentOS-7.iso:

qemu-system-x86_64 -m 1024 \
  -enable-kvm \
  -boot d \
  -cdrom CentOS-7.iso \
  centos-7.img

Set up NAT networking with TAP interface

See qemu-guest-network-in-nat-mode