How to Install KVM on Rocky Linux

KVM (Kernel-based Virtual Machine) is an open-source virtualization platform built into the Linux kernel. It acts as a bare-metal (Type 1) hypervisor, allowing you to create and run multiple virtual machines (VMs) on a single physical server. These VMs can run either Linux or Windows.

Like other virtualization tools, KVM takes your system’s hardware—CPU, memory, storage, and network—and shares it among the virtual machines, letting them operate independently as if they were separate computers.

Check if hardware virtualization is turned on

Before you get started, you’ll want to check if your system has virtualization enabled. Most modern systems have this turned on by default in the BIOS, but it’s always good to double-check.

You can do this by running a simple command that looks for vmx (for Intel CPUs) or svm (for AMD CPUs)—these are the flags that indicate hardware virtualization is supported.

# cat /proc/cpuinfo | egrep "vmx|svm"

Install KVM

After confirming that virtualization is enabled, the next step is to install KVM along with the necessary management tools.

# dnf install qemu-kvm virt-manager libvirt virt-install virt-viewer virt-top bridge-utils  bridge-utils virt-top libguestfs-tools

After installation, run this command to see if the KVM modules are loaded.

# lsmod | grep kvm

Start and Enable the libvirtd daemon

Make sure to start the libvirtd daemon. It’s a background service that helps manage virtual machines using technologies like KVM, Xen, and ESXi.

# systemctl start libvirtd
# systemctl enable --now libvirtd
# systemctl status libvirtd

Setup the Bridge Interface

We’ve set up KVM along with all the necessary management tools, and we’re able to create virtual machines successfully. However, to access these VMs from outside the hypervisor’s network, we need to set up a bridge interface.

Leave a Reply

Your email address will not be published. Required fields are marked *