On this pageThree layers, three jobs
"QEMU or KVM?" is a question with a misleading premise. On a Linux virtualization host they are partners, not alternatives. KVM is the part of the Linux kernel that uses the processor's virtualization extensions to run guest code directly on the CPU. QEMU is the program that builds the rest of the virtual machine around that code: disks, network cards, firmware, a display. A third layer, libvirt, manages both so you rarely call either one by hand. This guide explains the split and then builds a working VM.
Three layers, three jobs
| Layer | Runs where | Job | You touch it through |
|---|---|---|---|
| KVM | Inside the Linux kernel (kvm plus kvm_intel or kvm_amd) |
Executes guest instructions on the CPU and isolates guest memory, using Intel VT-x or AMD-V | /dev/kvm, indirectly |
| QEMU | One user-space process per VM | Emulates or paravirtualizes devices, loads firmware, owns the guest's memory map | qemu-system-x86_64, rarely by hand |
| libvirt | A daemon with a stable API | Defines VMs, networks and storage pools, starts and stops guests, applies security labels | virsh, virt-install, virt-manager, Cockpit |
QEMU is licensed GPL-2.0, KVM ships with the kernel under the same license, and libvirt uses the LGPL. The current QEMU release series is 11.1, from October 2026. KVM has no separate version: it moves with your kernel.
QEMU without KVM
Without /dev/kvm, QEMU falls back to its Tiny Code Generator (TCG), which translates every guest instruction in software. That is slow for running servers, and very useful for other purposes: booting an ARM image on an x86 machine, testing a firmware build, or, in user mode, running foreign binaries one at a time. Multi-platform container builds rely on exactly that, as the remote Docker builds guide shows.
KVM without QEMU
KVM accepts other user-space partners. Firecracker and Cloud Hypervisor are minimal virtual machine monitors built on KVM that drop most of QEMU's device emulation in exchange for fast boot times and a smaller attack surface. They suit serverless platforms and microVMs; QEMU remains the general-purpose choice for full operating systems.
Check that a server can run KVM
grep -Ec '(vmx|svm)' /proc/cpuinfo # more than 0: the CPU exposes VT-x (vmx) or AMD-V (svm)
ls -l /dev/kvm # the device QEMU opens for acceleration
lsmod | grep kvm # kvm plus kvm_intel or kvm_amd
sudo apt install -y cpu-checker && kvm-ok
kvm-ok prints "KVM acceleration can be used" when everything lines up. On a physical machine, a zero from grep usually means virtualization is disabled in the firmware setup.
Inside a virtual server, the host has to pass the extensions through, which is called nested virtualization. CloudSat servers run on KVM, and nested virtualization is available on plans with 8 GB of memory or more, for 11% on top of the plan price; it is chosen at deploy time, as the nested virtualization docs describe. Expect nested guests to be slower than guests on bare metal, especially for disk and network I/O.
Install the stack
On Debian or Ubuntu:
sudo apt update
sudo apt install -y qemu-system-x86 qemu-utils libvirt-daemon-system libvirt-clients virtinst
sudo usermod -aG libvirt "$USER" # log out and back in for the group to apply
virsh -c qemu:///system list --all
On AlmaLinux, Rocky Linux and Fedora the equivalent packages are qemu-kvm, libvirt and virt-install. qemu:///system is the system-wide connection that runs guests as a dedicated service user; members of the libvirt group may use it without sudo.
libvirt creates a NAT network called default, usually on the bridge virbr0 with addresses in 192.168.122.0/24. Guests on it reach the internet through the host, and the host reaches them, but nothing outside does unless you add port forwarding or a bridged network.
Create a VM from a cloud image
Cloud images skip the installer altogether: they boot straight into a working system and configure themselves with cloud-init. Ubuntu's .img cloud images are qcow2 files, so a thin overlay on top of the downloaded image is enough:
cd /var/lib/libvirt/images
sudo curl -LO https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
sudo qemu-img create -f qcow2 -F qcow2 -b noble-server-cloudimg-amd64.img web-vm.qcow2 20G
sudo virt-install \
--name web-vm --memory 2048 --vcpus 2 \
--disk path=/var/lib/libvirt/images/web-vm.qcow2,bus=virtio \
--import --osinfo ubuntu24.04 \
--network network=default,model=virtio \
--cloud-init clouduser-ssh-key="$HOME/.ssh/id_ed25519.pub" \
--graphics none --noautoconsole
virsh domifaddr web-vm
ssh ubuntu@192.168.122.50 # use the address domifaddr printed
--import skips the installer and boots the disk as it is. --osinfo sets sensible device defaults for the guest OS, and recent virt-install versions refuse to guess without it; virt-install --osinfo list shows the names your system knows, and linux2022 is a generic fallback. clouduser-ssh-key hands your public key to the image's default user, which is ubuntu on Ubuntu images.
Keep the base image unchanged: every VM created as an overlay depends on it.
Make guests fast
Most performance comes from a handful of choices:
- Virtio everywhere. Paravirtual disk and network devices avoid emulating real hardware. Linux guests include the drivers. Windows guests need the virtio-win driver package during installation.
- Expose the host CPU.
--cpu host-passthroughgives the guest every feature the host processor has. The trade-off is that live migration then needs an identical CPU on the destination host. - Pick the disk format deliberately. qcow2 offers snapshots, overlays and thin provisioning. Raw images are simpler and slightly faster when you need neither.
- Do not overcommit memory casually. A guest that swaps on the host performs far worse than a smaller guest that fits in RAM.
Everyday virsh commands
| Task | Command |
|---|---|
| List every VM, running or not | virsh list --all |
| Start, or shut down cleanly through ACPI | virsh start web-vm, virsh shutdown web-vm |
| Hard power-off (does not delete anything) | virsh destroy web-vm |
| Start with the host | virsh autostart web-vm |
| Attach to the serial console | virsh console web-vm (leave with Ctrl+]) |
| Snapshot before a risky change | virsh snapshot-create-as web-vm before-upgrade |
| Delete the VM and its disks | virsh undefine web-vm --remove-all-storage |
destroy has an alarming name and a harmless effect: it pulls the virtual power cord. undefine --remove-all-storage is the one that deletes data.
Back up or move a VM
A libvirt guest is two things: an XML definition and its disk images. Save both, and you can rebuild the VM on any host with the same stack:
virsh shutdown web-vm
virsh dumpxml web-vm > web-vm.xml
qemu-img convert -O qcow2 /var/lib/libvirt/images/web-vm.qcow2 web-vm-full.qcow2
# on the new host, after copying both files and fixing the disk path in the XML:
virsh define web-vm.xml
virsh start web-vm
qemu-img convert merges the overlay and its base image into one standalone file, so the copy no longer depends on the cloud image it started from. Shut the guest down first, or take the copy from a snapshot, because copying a disk that is being written produces an inconsistent image. For guests that change constantly, back up the data inside the VM as well, with the same tools you would use on any server.
FAQ
Is a KVM VPS the same as a QEMU virtual machine?
Usually yes, or close to it. Most Linux clouds run guests on KVM with QEMU or a lighter monitor on top. From inside, systemd-detect-virt prints kvm, and lspci lists virtio devices.
Should I use libvirt or call QEMU directly?
Use libvirt for anything that must survive a reboot or be managed by others: it keeps definitions, starts guests with the host and applies sandboxing. Call qemu-system-x86_64 directly for quick experiments, firmware testing and emulating other architectures.
Where does Proxmox fit?
Proxmox VE runs the same KVM and QEMU underneath, with its own management layer, web interface and clustering instead of libvirt. It suits hosts that run many VMs for a team; libvirt suits a server where a few VMs are one job among others.
Can the guests run Windows?
Yes. Attach the Windows installation ISO and the virtio-win driver ISO, load the storage driver during setup, and bring your own license.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




