How to install KVM on RHEL 8 / CentOS 8?. This guide will cover the full installation of KVM hypervisor and its management tools on  RHEL 8 / CentOS 8. KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux Systems running on x86 hardware with virtualization extensions (Intel VT or AMD-V).

KVM consists of a loadable kernel module,kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko. Follow the steps below to install KVM on your RHEL 8 server.

For VirtualBox: Installing VirtualBox on CentOS 8 / RHEL 8

Install KVM on RHEL 8 / CentOS 8 Linux

The next sections will take you through the steps to install the latest release of KVM hypervisor on RHEL 8. This will include the installation of KVM management tools – libguestfs-tools

Step 1: Ensure host CPU has Intel VT or AMD-V Virtualization extensions

The first step is to verify your CPU support for Intel VT or AMD-V Virtualization extensions. In some systems, this is disabled on BIOS and you may need to enable it.

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

You can also do the same with lscpu command

$ lscpu | grep Virtualization
Virtualization: VT-x

Step 2: Install KVM / QEMU on RHEL/ CentOS 8

KVM packages are distributed on RHEL 8 via AppStream repository. Install KVM on your RHEL 8 server by running the following commands:

sudo yum update
sudo yum install @virt

After installation, verify that Kernel modules are loaded

$ lsmod | grep kvm
kvm_intel 233472 0
kvm 737280 1 kvm_intel

Also install useful tools for virtual machine management.

sudo dnf -y install libvirt-devel virt-top libguestfs-tools

We have a guide on how to use libguestfs-tools like:

How to mount VM virtual disk on KVM hypervisor

Step 3: Start and enable KVM daemon

By default, KVM daemon libvirtd is not started, start the service using the command:

sudo systemctl enable --now libvirtd

Step 4: Install Virtual machine Manager GUI – Optional

If you have a Desktop Environment on your RHEL 8, you can install the virt-manager tool which allows you to manage Virtual Machines from a GUI.

sudo yum -y install virt-manager

Step 5: Create a VM instance on KVM

First, start by creating a network bridge to be attached to your instances.

How to Create a Linux Network Bridge on RHEL / CentOS 8

You can also refer to our guides below.

How to Create and Configure Bridge Networking For KVM in Linux

How to Create and use Network Bridge on Arch Linux and Manjaro

Once you have your bridge interface ready, create a test instance using CLI or Virtual Machine Manager. The example below is for creating a Fedora 34 VM.

virt-install \
--name fed34 \
--ram 2048 \
--vcpus 2 \
--disk path=/var/lib/libvirt/images/fed34.img,size=20 \
--os-variant fedora34 \
--os-type linux \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location '' \
--extra-args 'console=ttyS0,115200n8 serial'

The installation is on text mode but the procedure of installation is similar to GUI. After finishing the installation, reboot the instance and login

Fedora 34 (Server Edition)

Web console: https://localhost:9090/ or

localhost login:

You can also login through console:

$ virsh console fed34

Press <ENTER> key on getting:

Escape character is ^]

If you want to generate KVM VM templates, refer to How to Create CentOS / Fedora / RHEL VM Templates on KVM

You now have KVM installed on RHEL 8. Enjoy your Virtualization with RHEL 8 and KVM. See our Virsh Commands cheat sheet for a complete list of virsh commands.

Want to Automate VMs deployment on KVM, check out How to Provision VMs on KVM with Terraform

For installation through Virtual Machine Manager GUI, you may need to configure virt-manager as a non-root user on Linux

Also check RHEL and CentOS Kickstart on KVM Automated Installation With virt-install

Further reading:

Mastering KVM Virtualization

Virtualization Essentials, 2nd Edition

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here