How to Install and Configure KVM Hypervisor on RHEL 7

KVM stands for Kernel based Virtual machine is open source Virtualization infrastructure for Linux Kernel that turns Linux server into a Hypervisor that allows you to run multiple Linux and windows based machines.

KVM architecture

Also read : Boot process in Linux 

Prerequisites :

Check for Hardware compatibility for running KVMs

First precheck or prerequisite is to check whether our hardware/CPU  supports it or not. Run below command to check the same. If below command returns either vmx or svm in the output, that means our hardware is fine  for KVM and having  required CPU virtualization extensions.


For Intel based Hardware : vmx
For AMD based Hardware : svm


[root@himanshu ~]# cat /proc/cpuinfo | egrep 'vmx|svm'


Install KVM packages using Yum 

Below packages need to be installed on your Linux machine for installing  KVM hypervisor.

[root@himanshu ~]# yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils


 After installing the packages, start and enable the libvirtd service (Virtualization daemon)

[root@himanshu ~]# systemctl start libvirtd
[root@himanshu ~]# systemctl enable libvirtd

Run below command to check if KVM modules are loaded in kernel or not.

[root@himanshu ~]# lsmod | grep kvm
kvm_intel             170181  10
kvm                   554609  1 kvm_intel
irqbypass              13503  1 kvm

Check whether virt-manager tool is opening the GUI based tool to manage/launch machines.In case, same is not opening, install below x-window package and restart the server and check again.

[root@himanshu ~]# yum install "@X Window System" xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils –y


[root@himanshu ~]# virt-manager


Running virt-manager will pop up window (GUI tool)by which you can manage KVM machines.



Configure Bridge Interface 

If you want to access Virtual machines outside hypervisor network, you need to configure Bridge interface as below.


[root@himanshu ~]#cd /etc/sysconfig/network-scripts/
                         
[root@himanshu ~]#cp ifcfg-eno49 ifcfg-br0
                         
[root@himanshu ~]#cat ifcfg-eno49
TYPE="Ethernet"
BOOTPROTO="static"
DEVICE="eno49"
ONBOOT="yes"
BRIDGE="br0"

[root@himanshu ~]#cat ifcfg-br0
TYPE="Bridge"
BOOTPROTO="static"
DEVICE="br0"
ONBOOT="yes"
IPADDR="10.65.247.168"
PREFIX="23"
GATEWAY="10.65.246.1"

[root@himanshu ~]#systemctl restart network


Hope you have successfully installed and configured KVM hypervisor on your  RHEL/Centos 7 machine. Now you can easily start creating machines.


Also read : How to install Google chrome in Linux using CLI /Yum 



Comments

Popular posts from this blog

Create Ambigrams using Online Ambigram Generator

Evolution of Computer Processor : Intel at a Glance [Part-1]

25 Inspirational and Motivational Quotes Status Updates for Facebook