How To's Tutorials
KVM stands for Kernel Based Virtual Machine. KVM is a Linux kernel module that allows a user space program access to the hardware virtualization features of Intel and AMD processors. With the KVM kernel module, VMs run as ordinary user-space processes. KVM uses QEMU for I/O hardware emulation. QEMU is a user-space emulator that can emulate a variety of guest processors on host processors with decent performance. Using the KVM kernel module allows it to approach native speeds.
KVM is managed via the libvirt API and tools. Some libvirt tools used in this article include virsh , virt-install and virt-clone . Some of common Terms we will using this document is :
In this document we will learn how to install & configure KVM based virtualization step by step in CentOS 6.X / RHEL 6.X . I am assuming we have hypervisor with good configuration and CentOS / RHEL is installed on top of this.
# grep -E 'svm|vmx' /proc/cpuinfo
If VT is not enabled , then reboot the your server , go BIOS setting & enable it
# yum install kvm python-virtinst libvirt libvirt-python virt-manager virt-viewer libguestfs-tools bridge-utils
Verify the following kernel modules are loaded, and if not load manually:
# lsmod | grep kvm
To load the KVM module use below commands :
# modprobe kvm
# modprobe kvm_intel (only on Intel-based systems)
In my case my server has only one lan interface, so i will bind the ethernet (eth0) to bride interface (br0). Bridge interface is required to access the Virtual machine outside of hypervisor. Follow the below steps to create bridge “br0”.
# cd /etc/sysconfig/network-scripts
# cp ifcfg-eth0 ifcfg-br0
# vi ifcfg-br0
# vi ifcfg-eth0
Just replace the ip address according to your setup.
# chkconfig NetworkManager off ; service NetworkManager stop
# service network restart ; chkconfig network on
# service libvirtd start ; chkconfig libvirtd on
Note: KVM creates image files (which look just like regular files in the file system) for each VM and assumes you are going to place them in directory /var/lib/libvirt/images. If you don't like to use /var/lib/libvirt/images. then create a separate partition for VM images, like /vm-images.
(5.1 ) Open the terminal Type virt-manager
Click on Create a new Virtaul Machine
(5.2) when we click on Forward , it will ask for ISO file , so select the respective ISO file , in my i am selecting Ubuntu Server 12.10
(5.3) Now Specify the RAM and CPU / Cores , as shown below
( 5.4) Specify the Disk size for the virtual machine , by default a image will be created under /var/lib/libvirt/images , if you want to change the location the other option “Select managed or existing storage”
Click on Forward
(5.5) Click on Advance options , Select Bridge br0 and Click on Finish
(5.6) Installation of Ubuntu Server 12.10 using KVM virtualization has Started as shown below :
Double Click on “nextstep” , below screen will appear , login to the machine and configure the network settings in the machine and then try to access the VM from the network. This concludes the tutorial and enjoy the KVM based virtulaization :)
Configure VSFTPD Chroot