RHEL7 or CentOS7 Setup KVM Virtualisation Environment

In this RHEL7 / CentOS7 tutorial we will take a look at how to setup a kvm virtualisation. We started by installing an OS on the main system, where we add a kvm installation.

Installing KVM rpms

First we need to make sure the server supports hardware virtualisation by running the following as root, if nothing is displayed, then you are either need newer hardware or you need to enable virtualisation from within the BIOS:


# egrep '(vmx|svm)' --color=always /proc/cpuinfo

Install the necessary kvm packages using yum:


# yum -y install kvm libvirt python-virtinst qemu-kvm

After installing the needed packages we need to start the ‘libvirt’ daemon and enable it at boot time using the following commands:


# systemctl start libvirtd
# systemctl enable libvirtd

Check if everything is working fine:


# # virsh -c qemu:///system list
 Id    Name                           State
----------------------------------------------------

Install bridge-utils

The ‘bridge-utils’ package can be used to setup a network bridge so that our guests machines can be accessed each other. Install the bridge-utils using yum (if it is not installed already):


# yum -y install bridge-utils

After installing the package we need to actually need to create a network bridge. Use the nmcli command to create “/etc/sysconfig/network-scripts/ifcfg-br0” device browse around here. The command adds the bridge br0:


# nmcli c add type bridge autoconnect yes con-name br0 ifname br0
Connection 'br0' (b75f3dd0-2514-4e48-81b9-8dc036de46c4) successfully added faibvc1.

Edit the current network device (in our case this is enp0s25, so replace this with your NIC device name) and restart the network:


# echo BRIDGE="br0" >> /etc/sysconfig/network-scripts/ifcfg-enp0s25

# systemctl restart network

# ip a

After the restart the ip-adress that was previous on enp0s25 is now on br0 and the bridge is configured.

After completing the KVM installation, it’s time to start virtual machines (VM), but that will be discussed in a next tutorial.
That’s all for this tutorial on installing a KVM virtualisation environment.

This entry was posted in Linux Administration. You can follow any responses to this entry through the RSS 2.0 feed. You can trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

Leave a Reply: