Updated: 28 September 2026 · Applies to: Debian 12 and Ubuntu 24.04
Debian 9 is end of life; these steps are for Debian 12 and Ubuntu 24.04. KVM turns a Linux server into a hypervisor that runs virtual machines. On a headless server, you manage them with virsh and virt-install.
Check the hardware
grep -Ec '(vmx|svm)' /proc/cpuinfo # more than 0: the CPU supports virtualisation
Note: Run KVM on a dedicated server. A Ucartz VPS is already a KVM virtual machine and normally cannot run its own KVM guests.
Install
apt install qemu-system-x86 libvirt-daemon-system libvirt-clients virtinst bridge-utils libguestfs-tools virt-host-validate qemu
To manage VMs as a normal user, add the user to the libvirt group: adduser youruser libvirt, then log in again.
Create a virtual machine
osinfo-query os | grep -i alma # find the --osinfo name virt-install --name vm1 --memory 2048 --vcpus 2 \ --disk size=20 --osinfo almalinux9 \ --cdrom /var/lib/libvirt/images/AlmaLinux-9-latest-x86_64-minimal.iso \ --network network=default --graphics vnc,listen=127.0.0.1
Connect to the installer with an SSH tunnel and a VNC viewer: ssh -L 5900:127.0.0.1:5900 root@server, then open localhost:5900. Manage machines with virsh list --all, virsh start vm1, virsh shutdown vm1 and virsh autostart vm1.
The default network gives guests private addresses (NAT). For guests with their own public IPs, create a bridge (for example br0) with NetworkManager or Netplan and use --network bridge=br0; the additional IPs must be routed to your server.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
