Updated: 20 November 2026 · Applies to: AlmaLinux 9 / Rocky Linux 9
CentOS/RHEL 7 are end of life; these steps are for AlmaLinux 9 / Rocky Linux 9. KVM turns a server into a hypervisor for virtual machines.
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
dnf install qemu-kvm libvirt virt-install guestfs-tools
for drv in qemu network nodedev nwfilter secret storage interface; do systemctl enable --now virt${drv}d.socket; done
virt-host-validate qemu
Version 9 uses separate libvirt daemons per driver (virtqemud and others) instead of the single libvirtd, started on demand by the sockets above.
Web interface (optional)
Cockpit can create and manage VMs in the browser: dnf install cockpit cockpit-machines && systemctl enable --now cockpit.socket, then open https://SERVER-IP:9090. Allow the port only from your own IP.
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.
Tip: If you want to sell or manage many VPS, a control panel such as Virtualizor (which Ucartz uses) installs and manages KVM for you.