Install KVM on CentOS
Kernel based virtual machines, commonly known as KVM virtualization, are arguably one of the powerful and stable virtualization technologies. KVM builds on the power of hardware-based virtualization to deliver outstanding performance.
KVM virtualization is a popular choice because it does not support overselling natively. Coupled with our SSD servers, KVM virtualization will deliver a truly amazing experience for your clients. This article will outline how to install KVM on CentOS 6.

Linux-based KVM virtualization logo via OpenVirtualizationAlliance.org
KVM Hardware Requirements
To install KVM on CentOS, you need your dedicated server to support hardware virtualization. This is called Intel VT for Intel based CPU’s (specifically Intel Xeon’s), and AMD-V for AMD processors (specifically AMD Opteron’s).
How to Install KVM on CentOS Dedicated Server
Step 1: Install required packages
yum -y install @virt* dejavu-lgc-* xorg-x11-xauth tigervnc \ libguestfs-tools policycoreutils-python bridge-utils
Step 2: Set Sellinux context
semanage fcontext -a -t virt_image_t “/vm(/.*)?”; restorecon -R /vm
Step 3: Allow packet forwarding
sed -i ‘s/^\(net.ipv4.ip_forward =\).*/\1 1/’ /etc/sysctl.conf; sysctl -p
Step 4: Configure libvirtd
chkconfig libvirtd on; shutdown -r now
Host Setup is now complete! Time to setup the virtual containers.
Step 1: View available OS templates
virt-install –os-variant=list | more
Step 2: Select an OS variant
OS=”–os-variant=freebsd8″
OS=”–os-variant=win7″
OS=”–os-variant=win7 –disk path=/var/lib/libvirt/iso/virtio-win.iso,device=cdrom”
OS=”–os-variant=win2k8″
OS=”–os-variant=win2k8 –disk path=/var/lib/libvirt/iso/virtio-win.iso,device=cdrom”
OS=”–os-variant=rhel6″
Step 3: Select a network option
Net=”–network bridge=br0″ Net=”–network model=virtio,bridge=br0″
Net=”–network model=virtio,mac=52:54:00:00:00:00″
Net=”–network model=virtio,bridge=br0,mac=52:54:00:00:00:00″
Step 4: Select a disk option
Disk=”–disk /vm/Name.img,size=8″
Disk=”–disk /var/lib/libvirt/images/Name.img,size=8″
Disk=”–disk /var/lib/libvirt/images/Name.img,sparse=false,size=8″
Disk=”–disk /var/lib/libvirt/images/Name.qcow2,sparse=false,bus=virtio,size=8″ Disk=”–disk vol=pool/volume” Disk=”–livecd –nodisks”
Disk=”–disk /dev/mapper/vg_…”
Step 5: Select a source
Src=”–cdrom=/var/lib/libvirt/iso/iso/…”
Src=”–pxe”
Src=”-l http://alt.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os/” Src=”-l http://download.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os/”
Src=”-l http://ftp.us.debian.org/debian/dists/stable/main/installer-amd64/ Src=”-l http://ftp.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/”
Src=”-l http://download.opensuse.org/distribution/openSUSE-stable/repo/oss/” Src=”–location=http://mirror.centos.org/centos/6/os/x86_64″
Step 6: Select Number of CPU’s
Cpu=”–vcpus=1″
Cpu=”–vcpus=2″
Cpu=”–vcpus=4″
Step 7: Select amount of ram
Ram=”–ram=768″ Ram=”–ram=1024″ Ram=”–ram=2048″
Step 8: Choose a name for the guest
Name=”myvps”
Step 9: Create the guest
virt-install $OS $Net $KS $Disk $Src $Gr $Cpu $Ram –name=$Name
Step 10: Connect to the console
virt-viewer –connect qemu_ssh://myvps/$Name
Step 11: You can set this VPS to boot on server startup
virsh autostart $Name
————-
That’s it! Your CentOS dedicated server is now configured with KVM virtualization.
Contact our support team for questions on how to install KVM, or on choosing the perfect dedicated server for your KVM hosting needs.
Liked this post? Read more articles on System Administration or Dedicated Server Hardware.