Cheap Tickets to India
Dec 042018
 

If you want to learn virtualization, there are many avenues.

You can use Oracle VirtualBox, VMWare, KVM, Xen, HyperV, etc.

Since I was already familiar with other virtualization routes like Oracle VirtualBox, VMWare and HyperV, I decided to take the KVM plunge.

KVM stands for Kernel-based Virtual Machine and has been around since early 2007.

Before diving into KVM, first check if your CPU supports VT features in virtualization (Intel VT or AMD-V)

Use the below command to find whether your CPU supports VT features.

$ egrep '(vmx|svm)' /proc/cpuinfo
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority dtherm
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf eagerfpu pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority dtherm

As we can see from the above output, my CentOS 7.5 system has vmx.

So I’m good to go with KVM.

To manage the KVM virtual machines, I went ahead and installed the open source Virt Manager GUI for KVM.

Besides KVM, Virt-Manager is also said to support Xen and LXC (Linux Containers).

Here are the commands I used to install KVM on my CentOS 7.5 system.

$ sudo yum install -y qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer

Package 10:qemu-kvm-1.5.3-156.el7_5.5.x86_64 already installed and latest version
Package 10:qemu-img-1.5.3-156.el7_5.5.x86_64 already installed and latest version
Package bridge-utils-1.5-9.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package libvirt.x86_64 0:3.9.0-14.el7_5.7 will be installed
--> Processing Dependency: libvirt-daemon-driver-lxc = 3.9.0-14.el7_5.7 for package: libvirt-3.9.0-14.el7_5.7.x86_64
--> Processing Dependency: libvirt-daemon-config-nwfilter = 3.9.0-14.el7_5.7 for package: libvirt-3.9.0-14.el7_5.7.x86_64
---> Package libvirt-client.x86_64 0:3.9.0-14.el7_5.7 will be installed
--> Processing Dependency: gnutls-utils for package: libvirt-client-3.9.0-14.el7_5.7.x86_64
---> Package libvirt-python.x86_64 0:3.9.0-1.el7 will be installed
---> Package virt-install.noarch 0:1.4.3-3.el7 will be installed
--> Processing Dependency: virt-manager-common = 1.4.3-3.el7 for package: virt-install-1.4.3-3.el7.noarch
---> Package virt-manager.noarch 0:1.4.3-3.el7 will be installed
---> Package virt-viewer.x86_64 0:5.0-10.el7 will be installed
--> Running transaction check
---> Package gnutls-utils.x86_64 0:3.3.26-9.el7 will be installed
--> Processing Dependency: gnutls-dane(x86-64) = 3.3.26-9.el7 for package: gnutls-utils-3.3.26-9.el7.x86_64
--> Processing Dependency: libgnutls-dane.so.0(DANE_0_0)(64bit) for package: gnutls-utils-3.3.26-9.el7.x86_64
--> Processing Dependency: libgnutls-dane.so.0()(64bit) for package: gnutls-utils-3.3.26-9.el7.x86_64
---> Package libvirt-daemon-config-nwfilter.x86_64 0:3.9.0-14.el7_5.7 will be installed
---> Package libvirt-daemon-driver-lxc.x86_64 0:3.9.0-14.el7_5.7 will be installed
---> Package virt-manager-common.noarch 0:1.4.3-3.el7 will be installed
--> Processing Dependency: python-ipaddr for package: virt-manager-common-1.4.3-3.el7.noarch
--> Running transaction check
---> Package gnutls-dane.x86_64 0:3.3.26-9.el7 will be installed
---> Package python-ipaddr.noarch 0:2.1.11-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================================================================
 Package                                                  Arch                             Version                                      Repository                         Size
================================================================================================================================================================================
Installing:
 libvirt                                                  x86_64                           3.9.0-14.el7_5.7                             updates                           174 k
 libvirt-client                                           x86_64                           3.9.0-14.el7_5.7                             updates                           460 k
 libvirt-python                                           x86_64                           3.9.0-1.el7                                  base                              335 k
 virt-install                                             noarch                           1.4.3-3.el7                                  base                               94 k
 virt-manager                                             noarch                           1.4.3-3.el7                                  base                              652 k
 virt-viewer                                              x86_64                           5.0-10.el7                                   base                              394 k
Installing for dependencies:
 gnutls-dane                                              x86_64                           3.3.26-9.el7                                 base                               34 k
 gnutls-utils                                             x86_64                           3.3.26-9.el7                                 base                              237 k
 libvirt-daemon-config-nwfilter                           x86_64                           3.9.0-14.el7_5.7                             updates                           180 k
 libvirt-daemon-driver-lxc                                x86_64                           3.9.0-14.el7_5.7                             updates                           902 k
 python-ipaddr                                            noarch                           2.1.11-1.el7                                 base                               35 k
 virt-manager-common                                      noarch                           1.4.3-3.el7                                  base                              1.2 M

Transaction Summary
================================================================================================================================================================================
Install  6 Packages (+6 Dependent packages)

Total download size: 4.6 M
Installed size: 16 M
Is this ok [y/d/N]: y
[output truncated]

Good, you’ve now got KVM installed. It’s time to test it.

So I went and downloaded the lightweight Lubuntu 18.04.1.

If you’re on the Gnome 3.28 desktop, go to Applications—>System Tools—>Virtual Machine Manager.

This will open the Virtual Machine Manager and allow you to add whatever virtual machine you want to KVM.

I quickly attached Lubuntu 18.04.1 to KVM through the Virtual Machine Manager.

KVM with VM Lubuntu Attached

Voila, that’s it.

I was delighted that I had added one more item to my virtualization jewel-box.

The whole process of installing KVM and adding/updating Lubuntu took less than 15 minutes.

By the way, the above KVM installation was tested on CentOS 7.5 (kernel 3.10.0-862.11.6) running on an old Dell Optiplex 780SFF.

Useful Resources:
KVM
KVM on Wikipedia
Virt Manager
 Posted by at 8:21 pm

Sorry, the comment form is closed at this time.