2022 Tutorial for KVM under Linux – Centos

Tutorial for KVM under Linux - Centos 2022

 

Important Information about Centos “7” and “8” 2022

 

Tutorial for KVM under Linux 2022

 

Red Hat, the creators of Centos have recently made significant announcements about the future of Centos.

 

  • Centos 8

 

Support and development of Centos “8” were dropped at the end of 2021, putting Centos 8 on end-of-life as of now. This is a full 8 years ahead of the expected EOL date.

 

Red Hat states that CentOS 8 will become an upstream (development) branch of Red Hat Enterprise Linux (RHEL) called CentOS Stream.  In addition, they announced that the lifecycle of previous CentOS versions, including Centos 7  will be unchanged and that if you don’t already use it, Centos 8 shouldn’t be deployed in production environments.

 

A rebuild point release of Centos 8, version 8.5, is to be released in January 2022.   There will be no more updates to Centos 8 after that release.

 

The important message to take from this is that there are no more updates and bug fixes to Centos 8 from now on.  You could therefore be at risk from new malware and other security threats.

 

Further information can be found on the Red Hat website.

 

 

  • Centos 7

 

Red Hat has said that Centos 7 will be unaffected by the Centos 8 announcement.  Its support EOL will stay as June 2024. That, however, may change.

 

 

Linux KVM under Centos 8

 

Although we don’t recommend it because of the support limitations, if you are already using Centos 8 you can install KVM.

  • Step 1 – confirm that virtualisation is available on the server.  KVM can be used on any x86 hardware with virtualization extensions (Intel VT or AMD-V).  It can be disabled by default on some motherboards, and you may need to update the BIOS.   KVM needs to have its CPU virtualisation extensions loaded to run.
  • Step 2 – install the KVM Virtualisation Tools.

2a – Carry out system kernel upgrades, then reboot the system.

2b – install the KVM Virtualisation tools and type y to accept the installation.

 

  • Step 3–Install any other KVM Management tools
  • Step 4–Get the KVM daemon up and running
  • Step 5–If you want the Virtual Machine GUI – install it.
  • Step 6 –If required – create network bridges

 

You can now create virtual machines on Linux KVM.

 

 

Linux KVM under Centos 7

 

Installing KVM is basically the same as under Centos 8.

 

  • Step 1 – confirm that virtualisation is available on the server.  KVM can be used on any x86 hardware with virtualization extensions (Intel VT or AMD-V).   It can be disabled by default on some motherboards, and you may need to update the BIOS.   KVM needs to have its CPU virtualisation extensions loaded to run.
  • Step 2 –Install KVM and the associated packages.
  • Step 3 – Start and enable the libvirtd service
  • Step 4 – If you are running Minimal Centos 7 you now need to install x-windows
  • Step 5 – If required – create network bridges. (Remember to restart the network manager service).

You can now create virtual machines on KVM.

 

Linux KVM and Windows

 

The big restriction here is that KVM as a kernel module is an integral part of the Linux distribution, and therefore won’t run independently under the Windows operating system.  However, it can be used to create and manage virtual servers running the Windows Server and Windows desktop operating systems.

 

How To Uninstall KVM 2022

 

Many servers with three different devices

 

Above we showed how to install Linux KVM on Centos 7 and Centos 8, but there may be occasions when you need to uninstall it.  Perhaps the server is being repurposed or downgraded from Centos 8 to Centos 7 because of support concerns.

 

By removing Linux KVM you will also be removing all the virtual server instances.  It is an absolute no-brainer that you must take complete restorable backups of all the virtual servers before beginning the KVM uninstallation process.

 

Essentially a two-step process: remove all VMs, then KVM Linux itself.

Removing Virtual machines is a very simple process using the virsh command. All you need is the domain name. You will need privileged access to your Linux KVM installation.

 

  • Step 1 – Destroy the Virtual machine
  • Step 2 – Undefine the Virtual machine in the various XML and virtual disk configurations files.
  • Step 3 – Repeat as required for all virtual machines.

 

There is a good tutorial on the process here.

 

After this, KVM is still on the server and is perhaps still running. You can’t fully remove KVM since it is a core component of Linux.  You can only switch it off.

 

Use sudo to purge the KVM instance then check that all references to it are removed from the /etc/ directory.

That’s it.

 

What to Do?

 

If you are on Centos 7 – stay there, do not upgrade to Centos 8.

If you are on Centos 8 or need advice or help from our specialists, talk to us about alternatives that will provide support. We can help.

 

  • Share: