Skip to content

Instantly share code, notes, and snippets.

@beriberikix
Last active December 21, 2023 22:12
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save beriberikix/e5ba7b33c9da54af1f0b07561907e1ba to your computer and use it in GitHub Desktop.
Save beriberikix/e5ba7b33c9da54af1f0b07561907e1ba to your computer and use it in GitHub Desktop.
QEMU cheat sheet for the most basic setup

Create system drive

qemu-img create -f qcow2 alpine.qcow2 16G

Install image

Linux

qemu-system-x86_64 \
-enable-kvm \
-cpu host \
-m 4G \
-nic user,model=virtio \
-drive file=alpine.qcow2,if=virtio \
-cdrom alpine-virt-3.18.0-x86_64.iso

macOS

qemu-system-x86_64 \
-accel hvf \
-cpu host \
-m 4G \
-usb \
-device usb-tablet \
-nic user,model=virtio \
-drive file=alpine.qcow2,if=virtio
-cdrom alpine-virt-3.18.0-x86_64.iso

Windows

qemu-system-x86_64 `
-accel whpx,kernel-irqchip=off `
-m 4G `
-usb `
-device usb-tablet `
-nic user,model=virtio `
-drive file=alpine.qcow2,if=virtio `
-cdrom alpine-virt-3.18.0-x86_64.iso

Boot OS

Linux

qemu-system-x86_64 \
-enable-kvm \
-nographic \
-cpu host \
-m 2G \
-nic user,model=virtio \
-drive file=alpine.qcow2,if=virtio

macOS

qemu-system-x86_64 \
-accel hvf \
-nographic \
-cpu host \
-m 2G \
-nic user,model=virtio \
-drive file=alpine.qcow2,if=virtio

Windows

qemu-system-x86_64 `
-accel whpx,kernel-irqchip=off `
-nographic `
-m 2G `
-nic user,model=virtio `
-drive file=alpine.qcow2,if=virtio

Notes

  1. Exit -nographic with CTRL-A X
  2. When -nograpgic is used initial boot output is hidden
  3. Commands above use extra RAM when installing to speed up the process
  4. -accel whpx,kernel-irqchip=off workaround for Windows
  5. -usb -device usb-tablet automatically frees mouse when in graphical mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment