Simple steps to install KVM in Linux
By Jithin on January 28th, 2017
In this tutorial we can learn how to install KVM in Linux
KVM stands for kernel based virtual machine. KVM is an open source hardware virtualization software, so we can install KVM free of charge. We can create and run multiple Linux and Windows based operating systems on KVM. The KVM module loaded into the current kernel will change our Linux machine to the hypervisor. We can manage KVM by using command line or available graphical tools. Generally virtual machine manager is the most widely used graphical tool for managing KVM virtual machines.
Features of KVM
1) KVM supports all OS.
2) Low cost.
4) Swap space is supported.
5) KVM virtualization provides a true VMisolation.
Before starting installation, we need to check our systems CPU supports Hardware virtualization.
Execute the following command on the console:
# grep -E ‘(vmx|svm)’ /proc/cpuinfo
We should get the result whether vmx or svm, in case the result is different, your Systems CPU doesn’t support the Hardware virtualization.
1) Run the following command to install KVM and its dependency packages.
# yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils
2) Start and enable libvirtd service.
# systemctl start libvirtd
# systemctl enable libvirtd
3) We can check whether KVM module is loaded or not, by executing the following command.
# lsmod | grep kvm
kvm_intel 162153 0
kvm 5254409 1 kvm_intel
Creating Virtual Machines
Once you have installed KVM, you can create multiple virtual machines on it. We can create virtual machines in both command line and graphical mode (virtual machine manager). Here we are using virt-install command to create virtual machines using command line. At the time of creating virtual machine we need to specify CPU, Memory, disk, network…etc.
# virt-install –name=itzgeekguest –ram=1024 –vcpus=1 –cdrom=/tmp/CentOS-6.5-x86_64-minimal.iso –os-type=linux –os-variant=rhel6 –network bridge=br0 –graphics=spice –disk path=/var/lib/libvirt/images/itzgeekguest.dsk,size=4
name – Name of virtual machine
ram – Memory
vcpus – Virtual cpu’s in numbers
cdrom – Location of the ISO image
os-type – OS type like Linux, Windows and Unix
network – Networking
graphics – Guest display settings
disk path – Location of the disk with size of 4 GB
Here we are using bridged networking “br0” for allowing virtual machines to communicate with outside network.
If you need any further assistance please contact our support department.