×


Install KVM on Rocky Linux 8 / AlmaLinux 8 - Step by step guide ?

Virtualization is a popular technology used in cloud-based services and even in modern day datacenters to host applications. So what exactly is virtualization? This is a process of creating a virtual machine(s) from the hardware components of a PC using a hypervisor. Virtual machines, also known as guests, are isolated environments that run their own operating system independently of the host system which is the physical hardware. The hypervisor provides an additional layer on top of the physical system that enables the abstraction of hardware components such as CPU, RAM, disk space, USB controllers, keyboard, mouse, NICs and so much more.

You can create multiple virtual machines from a single PC hardware provided it has the right amount of resources required to run the virtual machines. Benefits of virtualization include reduced operational costs, increased efficiency and productivity, and faster provisioning of services and applications.

KVM ( Kernel Virtualization Manager ) is an opensource virtualization technology built specifically for Linux operating system. It converts your system into a type 1 hypervisor and allows users to create virtual machine instances using either the GUI or on command-line.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related KVM queries.

In this context, we shall look into how to install KVM on Rocky Linux / AlmaLinux.


Steps to Install KVM on Rocky Linux 8 / AlmaLinux 8

1. Check if virtualization is supported

To begin, check if Virtualization is enabled on your system. Modern systems typically come with the virtualization feature enabled in the BIOS. To confirm that the virtualization feature is enabled, run the command:

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

If you are running an Intel CPU, you should get the "vmx" keyword in the output. This is proof that Virtualization is enabled.

If the output does not contain the "vmx" keyword , then you need to go back to the BIOS settings and turn on virtualization.

Additionally, you can check if KVM modules are enabled using the command:

$ lsmod | grep kvm

Now, you can proceed with the installation of KVM.


2. Install KVM on Rocky Linux / AlmaLinux

First, upgrade the existing software packages with the below command:

$ sudo dnf update 

When the upgrade is complete, install KVM along with other KVM management tools for managing the virtual machines:

$ sudo dnf install qemu-kvm qemu-img libvirt virt-manager virt-install virt-viewer libvirt-client

Once installed, start and enable the libvirtd service which is a virtualization daemon and a toolkit for managing virtualization platforms such as KVM, Xen, and ESXi:

$ sudo systemctl start libvirtd
$ sudo systemctl enable libvirtd

Then confirm the running status of the daemon:

$ sudo systemctl status libvirtd


How to Launch a Virtual machine with Virt-manager ?

At this point, KVM and all of its associated packages required for the installation and management of virtual machines is installed. The virt-manager utility is a graphical tool that is used for graphically creating and launching virtual machines using the libvirt service.

There are different ways you can use to launch virt-manager. You can use the application manager to search for it as follows:

virtual Machine

On command-line, simply run the command:

$ sudo virt-manager

This will pop open the Virt manager desktop interface.

Click on the top-left icon to start creating a virtual machine.

The next step presents you with a list of options on how you would like to install your virtual machine. In our case, We are installing Debian 10 from an ISO image. So we selected the first option 'Local Install Media'. Your scenario may be different from mine. Other options include:

  • Network Install ( HTTP, HTTPS, FTP )
  • Network Boot ( PXE )
  • Importing existing boot image

Once you have selected your preferred installation method, click on 'Forward'.

If you selected the first option, click on 'Browse'.

This takes you to this window where you need to click on 'Browse local' to browse your Linux system for the location of the ISO image or DVD ROM.

Navigate to the directory that contains your ISO image.In our case, the ISO image is contained in the 'Downloads' directory.

Back to the Virtual machine manager. The path of the installation media is already selected. Down below, Specify the Operating system and click 'Forward'.

Specify the memory or RAM in Megabytes and the number of CPU cores and click 'Forward'.

Next, specify the disk space and enable storage for the virtual machine and click 'Forward'.

Finally, review your settings and click 'Finish' to wind up creating the virtual machine.

The virtual machine manager will start allocating the resources you selected to your virtual machine.

Once done, the virt-viewer GUI will pop up prompting you to begin the installation of the operating system. In the Debian 10, the installer prompting you to select your preferred option to commence the installation will show up.

When you head back to the Virtual machine manager, you will find that your virtual machine is up and running. From here, you can manage your virtual machine including starting, pausing, stopping, and cloning the virtual machine.


[Need assistance in configuring KVM on your Linux system ? We can help you. ]


Conclusion

This article covers the installation of KVM on Rocky Linux / AlmaLinux. In fact, Kernel-Based Virtual Machine (KVM) is an open-source Linux-based hypervisor that is inbuilt within the Linux Linux Operating systems. Is grouped as a type 1 hypervisor as it possesses type 1 characteristics such as direct access to hardware with VM's. It has kvm.ko kernel module which creates a core virtualization infrastructure and supports both Intel and AMD processors.