Cheap Tickets to India

How to Install & Use KVM Virtualization on CentOS 7.5

 Linux  Comments Off on How to Install & Use KVM Virtualization on CentOS 7.5
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

Fedora 29 KDE Plasma – First Impressions

 Linux  Comments Off on Fedora 29 KDE Plasma – First Impressions
Nov 022018
 
Fedora 29 KDE Plasma - First Impressions

Although my go-to Linux distros are CentOS and Linux Mint, I occasionally give Fedora a spin. So when Fedora 29 debuted on October 30, 2018, I decided to take the upgrade out for a spin. Fedora 29 KDE Plasma Fedora is always about choice and, besides the default GNOME 3.3 Read More

 Posted by at 4:25 pm

10 Key IP Commands on CentOS 7 & RedHat 7

 How To, Linux  Comments Off on 10 Key IP Commands on CentOS 7 & RedHat 7
Sep 232018
 

Getting a good handle on IP commands will prove useful if you’re managing a Linux box. Although ifconfig was deprecated and replaced with ip several years ago, some folks sill use ifconfig. But it’s good to be aware of the basic ip commands when you’re managing a Linux server. Here Read More

 Posted by at 2:19 pm

How to Install KeePassX on CentOS 7

 Linux, Security  Comments Off on How to Install KeePassX on CentOS 7
Sep 232018
 
How to Install KeePassX on CentOS 7

Even if you’re an Einstein, there’s no way you can remember all the user names and passwords for your Hotmail, Netflix, Gmail, multiple Bank accounts, Credit Card accounts, Dropbox and other sundry login details. People without a password manager tend to write the user names and passwords on a piece Read More

 Posted by at 2:17 pm

How to Set Up Mail Accounts on Plesk Control Panel

 How To  Comments Off on How to Set Up Mail Accounts on Plesk Control Panel
Sep 132018
 
How to Set Up Mail Accounts on Plesk Control Panel

Plesk is a user friendly, GUI control panel (like Cpanel or Webmin) for administering web sites and setting up e-mail accounts. Several hosting providers offer Plesk as part of their hosting package or as an addon service. This blog post is useful for people who aspire for a role as Read More

 Posted by at 2:11 pm

How do You Know if MySQL is Running on CentOS 7?

 General, How To  Comments Off on How do You Know if MySQL is Running on CentOS 7?
Sep 122018
 

Just this morning, someone asked me for the command to check if MySQL (or MariaDB) is running? I quickly blurted out: Do a top or htop and you should see it. # top | grep mysqld 26125 mysql 20 0 2618520 193692 9092 S 62.5 2.4 159:29.14 mysqld 26125 mysql Read More

 Posted by at 1:46 pm