Linux VPS

Install KVM on AlmaLinux or Rocky Linux

Install KVM on AlmaLinux or Rocky Linux 8/9: check virtualization support, install the virtualization host packages, start libvirt's modular daemons, create a bridge with nmcli and use Cockpit.

IntermediateAlmaLinux and Rocky Linux servers2 min read

AlmaLinux and Rocky Linux are popular RHEL-compatible distributions for servers. This guide shows how to install KVM on AlmaLinux or Rocky Linux 9 (the steps are almost the same on 8), set up bridged networking with NetworkManager and manage VMs from the Cockpit web console.

Before you start

  • A dedicated server or physical machine with AlmaLinux or Rocky Linux and root access.
  • VT-x or AMD-V enabled; see enable hardware virtualization.
  • Console or IPMI access for network changes.

Check CPU support

grep -E -c '(vmx|svm)' /proc/cpuinfo

The result must be greater than 0.

Install KVM packages

dnf update -y
dnf install -y qemu-kvm libvirt virt-install virt-viewer libguestfs-tools

On version 9 libvirt uses modular daemons. Enable them:

for drv in qemu network nodedev nwfilter secret storage interface; do systemctl enable --now virt${drv}d.socket; done

On version 8, use systemctl enable --now libvirtd instead.

Validate the host

virt-host-validate qemu

All QEMU checks should show PASS. A warning about IOMMU only matters if you need PCI passthrough.

Create a bridge with nmcli

Replace eno1 and the addresses with yours, and run from the console:

nmcli con add type bridge ifname br0 con-name br0 ipv4.method manual ipv4.addresses 203.0.113.10/24 ipv4.gateway 203.0.113.1 ipv4.dns "1.1.1.1 8.8.8.8"
nmcli con add type bridge-slave ifname eno1 master br0
nmcli con down "eno1" ; nmcli con up br0

The old connection name may differ; list them with nmcli con show. Check with ip a show br0.

Manage VMs with Cockpit

dnf install -y cockpit cockpit-machines
systemctl enable --now cockpit.socket

Open https://server-ip:9090, log in with a system user that has sudo, and go to Virtual machines → Create VM. Restrict port 9090 to your IP with firewalld:

firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="198.51.100.5" service name="cockpit" accept' && firewall-cmd --reload

You can also create VMs from the CLI; see virt-install.

Troubleshooting

  • SELinux denies access to images: keep disks in /var/lib/libvirt/images or relabel a custom path with semanage fcontext and restorecon.
  • virsh cannot connect: the modular daemon sockets are not enabled.
  • No network after creating bridge: fix from console with nmcli; ensure the slave connection is up.

Frequently asked questions

Is virt-manager still available?

It was deprecated in RHEL 9 in favour of Cockpit, but you can run virt-manager on a desktop and connect over SSH.

AlmaLinux or Rocky for KVM?

Both are binary-compatible with RHEL; KVM works the same on either.

Does this work on a VPS?

Only if nested virtualization is enabled; see nested virtualization.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.