Site icon CentLinux

How to Setup KVM Hypervisor on CentOS 8

Share on Social Media

Learn how to setup KVM hypervisor on CentOS 8 with our step-by-step guide. Get detailed instructions on installation, configuration, and management of virtual machines using KVM. #centlinux #linux #virtualization

What is KVM Hypervisor?

A KVM hypervisor is a type of hypervisor that uses the Kernel-based Virtual Machine (KVM) technology to enable virtualization on Linux. Here are some key points about the KVM hypervisor:

How KVM Works

Features

Advantages

Use Cases

Management Tools

In summary, the KVM hypervisor is a powerful and efficient virtualization solution integrated into the Linux kernel, providing a robust platform for running multiple isolated virtual machines with excellent performance and flexibility.

In this article, we are installing KVM virtualization host on CentOS 8. We are also installing Cockpit to manage our KVM Virtualization environment through a graphical interface.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

KVM Hypervisor vs VMWare

When comparing KVM (Kernel-based Virtual Machine) and VMware, it’s essential to consider various factors such as performance, cost, features, and use cases. Here’s a breakdown of the key differences and similarities between KVM and VMware:

KVM (Kernel-based Virtual Machine)

Overview:

Pros:

Cons:

Use Cases:

VMware

Overview:

Pros:

Cons:

Use Cases:

Summary

KVM:

VMware:

Read Also: How to install KVM Virtualization on Rocky Linux 9

KVM Hypervisor Requirements

The recommended system requirements for KVM Hypervisor are:

Linux Server Specification

We have configured a CentOS 8 minimal installed virtual machine with following specification.

Setup KVM Hypervisor on CentOS 8

Connect with kvm-virtualization-01.recipes.com using ssh as root user.

Verify support for Virtual Technology by the CPU.

# lscpu | grep Virtualization
Virtualization:      VT-x
Virtualization type: full

The output of the above command shows that, our server kvm-virtualization-01.recipes.com supports Virtualization.

However, if the above command returns no result on your server then,

  1. In case of bare-metal machine, you have to enable the VT support from system BIOS.
  2. In case of virtual machine, you have to enable the VT support from VM’s CPU Settings.

In CentOS 8 / RHEL 8, virtualization components including KVM and QEMU hypervisors are bundled in virt module. Therefore, it is really simple now to configure a KVM virtualization host in CentOS 8.

We are installing virt module using dnf command.

# dnf install -y @virt

We are also installing virt-install package, because it provides some very useful command line tools.
# dnf install -y virt-install

Validate all the components on your Linux server can support virtualization.

# virt-host-validate
...
  QEMU: Checking if IOMMU is enabled by kernel                               : WARN (IOMMU appears to be disabled in kernel. Add intel_iommu=on to kernel cmdline arguments)

It looks like IOMMU (input-output memory management unit) support is not yet enabled in the Linux Kernel.

The solution is already suggested by the above command. Therefore, we are adding the same in the Kernel command line options.

# grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) intel_iommu=on"

Restart your machine to make the above change effective.

# systemctl reboot

After reboot, again run the virt-host-validate command.

# virt-host-validate
...
  QEMU: Checking if IOMMU is enabled by kernel                               : PASS

Everything is fine now.

KVM and QEMU hypervisors has been installed on CentOS 8.

Install Cockpit on CentOS 8

Although, KVM commandline-tools are quite sufficient for managing a Virtualization environment. But, we can also use Cockpit (CentOS 8 native Web UI) to manage virtual machines via a graphical interface.

We can install Cockpit using dnf command.

# dnf install -y cockpit

To add support of managing virtual machines via Cockpit, we have to install cockpit-machines package.

# dnf install -y cockpit-machines

Enable and start Cockpit Unit.

# systemctl enable --now cockpit.socket
Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket â /usr/lib/systemd/system/cockpit.socket.

Cockpit service is by-default allowed in CentOS 8 firewall.

Open URL https://kvm-virtualization-01.recipes.com:9090/ in a web browser.

The Cockpit uses a self-signed SSL certificate, therefore, you may see a Security warning.

Ignore the Security warning and continue to the website.

Cockpit Login

Login to Cockpit Web UI as root user.

Cockpit Dashboard

Click on the Virtual Machines from the left side-pane.

Cockpit Web UI – Virtual Machines

We are now at the Virtual Machines page. We can manage our KVM virtualization environment from here.

For further studies, please read Foundations of Libvirt Development (PAID LINK) by Apress.

Final Thoughts

Setting up a KVM hypervisor on CentOS 8 can significantly enhance your virtualization capabilities, providing a robust and efficient platform for managing multiple virtual machines. By following the steps in this guide, you can successfully install and configure KVM, enabling you to maximize your server’s potential and streamline your IT operations.

If you need further assistance or personalized support with your KVM hypervisor setup, don’t hesitate to reach out to me on Fiverr: Configure VPS & Dedicated Servers. I’m here to help you with all your virtualization needs.

Exit mobile version