How To Install and Use KVM on CentOS Stream 8

In today’s guide we will be installing KVM on CentOS Stream 8 Linux operating system. KVM (Kernel-based Virtual Machine) is an open source virtualization technology built into Linux Kernel. KVM can be used on any x86 hardware with virtualization extensions (Intel VT or AMD-V). The role of KVM as hypervisor is specification of the host resources — Memory, CPUs, and virtual devices availed to the virtual machine instances being defined.

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. Below diagram illustrates how the KVM hypervisor virtualizes the compute resources for Linux on KVM.

kvm-virtualization-technology-1024x860
credits: IBM

Your hardware needs to have CPU virtualization extensions; Intel VT for Intel or AMD-V for AMD processor. In some systems, this is disabled on BIOS and you may need to enable it.

The lscpu command can also be used to check for virtualization CPU extensions:

This confirms I have Intel processor and VT-x extension

Let’s start by performing system upgrades to use Kernel updates that could be available.

If there are Kernel related updates consider performing system reboot then install KVM Virtualization Tools on CentOS Stream 8:

Accept installation by pressing the y key:

Check if Kernel modules are loaded:

Let’s perform installation of other tools that helps with the management of Virtual Machines on KVM:

We have an example guide showing how libguestfs-tools can be used: How to mount VM virtual disk on KVM hypervisor

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

Also enable the service to be started at system boot:

Check if service is started successfully:

If running a Desktop Environment on your CentOS Stream 8, you can install the virt-manager package which provides Desktop Management application for your KVM Virtual Machines.

Begin installation of Virt-manager on CentOS Stream 8:

The Linux bridge virbr0 is created at the time of installation and can be used to create Virtual Machines that doesn’t need external IP connectivity. It uses NAT to give VMs internet access.

If you need a bridge with external connections support, refer to the guide below on creation:

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

You can use virt-install command to create a Linux Virtual Machine on KVM.

I’ll download CentOS Stream 8 DVD installation ISO file

VM installation using virt-install:

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

You can also login through console:

Press key on getting:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ComputingPost

ComputingPost — Linux Howtos, Tutorials, Guides, News, Tips and Tricks.