Setting up KVM On CentOS7/RHEL7.0

Raw Steps –


1- Checkcing if system does support Intel VT and AMD-V for Virtualization Support.

This is hardware accelerated virtualization platform to support multiple unmodified OS version to run simultaneously on x86 platform without any issue.

Checking the following parameter on system to ensure if we do have the following features avaiable for virtualization

vmx — Intel VT-x, virtualization support enabled in BIOS.
svm — AMD SVM,virtualization enabled in BIOS.
lm – Can run 64-bit machines.
aes – Applications performing encryption and decryption using the Advanced Encryption Standard on Intel and AMD cpus.
[root@ip-172-31-14-165 ~]# egrep –color -i “vmx|svm” /proc/cpuinfo

2- Installing KVM package

[root@ip-172-31-14-165 ~]# yum -y install kvm virt-manager libvirt virt-install qemu-kvm xauth


3- Networking –

(i) Enabling IP forwarding for ethernet.
[root@ip-172-31-14-165 ~]# echo -e “net.ipv4.ip_forward = 1\n” >> /etc/sysctl.d/99-sysctl.conf
[root@ip-172-31-14-165 ~]# sysctl -p /etc/sysctl.d/99-sysctl.conf
net.ipv4.ip_forward = 1
[root@ip-172-31-14-165 ~]#

(ii) Creating virbr0 interface

Commenting out IPADDR, NETMASK, GATEWAY & added BRIDGE element as below. you can have multiple nics, can create bond for redundency purpose. I have chosen single nic as I dont have infrastrcture available with me

[root@ip-172-31-14-165 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
[root@ip-172-31-14-165 ~]#
(iii) Creating BRIDGE INTERFACE virbr0 to enabling communciation of guest VMs to Hypervhost KVM. it would be NAT communicatation

[root@ip-172-31-14-165 ~]# cat /etc/sysconfig/network-scripts/ifcfg-virbr0
4- check if kernal has loaded KVM module
[root@ip-172-31-14-165 ~]# lsmod | grep -i kvm
[root@ip-172-31-14-165 ~]# modprobe kvm
[root@ip-172-31-14-165 ~]# lsmod | grep -i kvm
kvm                   461126  0
[root@ip-172-31-14-165 ~]#

5- You can use the following command to check if bridge interface is enabled.

[root@ip-172-31-14-165 ~]# brctl show
bridge name     bridge id               STP enabled     interfaces
[root@ip-172-31-14-165 ~]#
6- checking the KVM virtual list –

1- You might get the following issue. Enable libvirtd services and rest would be ok.

[root@ip-172-31-14-165 yum.repos.d]# virsh -c qemu:///system list
error: failed to connect to the hypervisor
error: Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’: No such file or directory
[root@ip-172-31-14-165 yum.repos.d]# systemctl enable libvirtd
[root@ip-172-31-14-165 yum.repos.d]# systemctl start libvirtd
[root@ip-172-31-14-165 yum.repos.d]# virsh -c qemu:///system list
Id    Name                           State

[root@ip-172-31-14-165 yum.repos.d]#

7 – checking what OS variant is supported on KVM. if this command does not work by any reason,you could use ‘osinfo-query os’ and it provides the list of template KVM support to host as virtual machine
[root@ip-172-31-14-165 ~]#virt-install –os-variant=list
[root@ip-172-31-7-80 ~]# osinfo-query os

Short ID             | Name                                               | Version  | ID
altlinux1.0          | Mandrake RE Spring 2001                            | 1.0      |
altlinux2.0          | ALT Linux 2.0                                      | 2.0      |


8- Creating Virtual Machine –

[root@ip-172-31-7-80 ~]# virt-install –connect qemu:///system -n satyawin8 -r 2048 –vcpus=2 –disk path=/var/lib/libvirt/images/vmwin8.img,size=20 –graphics vnc,listen= –noautoconsole –os-type windows –os-variant win8 –accelerate –network=bridge:virbr0 –hvm –cdrom /var/X19-12345.iso
Starting install…
Allocating ‘vmwin.img’ | 20 GB 00:00:00
Creating domain… | 0 B 00:00:00

Domain installation still in progress. Waiting for installation to complete.



OVIRT is comming soon 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: