How To Install CentOS 6.3 KVM on vSphere 5.1

In the course of building my lab for my Nicira NVP role, I needed to install various hypervisors, in particular Linux KVM so I could install and test the Nicira NVP setup.  Of course I did not want to do this on bare metal and I have no intention of trying to set up OpenStack or CloudStack just yet, I can make do with the hypervisors only.  I will do some other blog posts on the importance of the Cloud Management System to the Nicira NVP components.  For the purposes of this post I wanted to share the documentation I collected on just what is needed to get KVM on CentOS 6.3 up and running specifically for use with Nicira NVP.

Step 1 – Configure the Virtual Machine Shell

This was something I learned the hard way.  With vSphere 5.1 you cannot create a new VM in the Windows vSphere client and allow the virtualization features of the processor to be presented.  This check box option as best I can tell is only available in the new vSphere Web Client.  So you will want to use the web client to create the shell not the windows client.

You can see the Virtualization option below:

 You will also notice this option will only be available if you select Compatibility of ESXi 5.1 and later VM Version 9.  GO ahead and select CentOS (64-Bit) as the guest operating system for now.  Once you have set up your Virtual Machine shell with the memory and other options you want, you can start your OS install.  My basic shell set up:

  • 4 vCPU
  • 6GB RAM
  • 20GB Disk
  • 3 NIC’s (Management, NVP Transport, Storage)

Step 2 – Install CentOS with Virtualization Features

This is pretty easy.  Fire up the CentOS installer and selection “Virtual Host”.  You also want to customize the install and add in the “Virtualization Tools”.  Once the install is completed the real work can begin.  You can also do the “Minimal” install from the smaller ISO file, but then you will need to add all the virtualization group components which is also easy enough using the following command:

# yum groupinstall "Virtualization*"

Step 3 – Install Other Packages, Updates, and Tools

At this point you may want to add and configure a few things so you can clone this VM and be ready for further customization.  Below are some of the updates, packages, and edits you may want to do on this host.

# yum install dejavu-lgc-sans-fonts xorg-x11-xauth openssh-askpass make gcc kernel-headers
# yum update
# reboot

NOTE: – When you SSH use -X to enable X11 redirection to your client for running virt-manager, and you will need an X11 setup on your Mac (XQuartz), or Windows.

Copy the Open vSwitch files to the Host and install them:

# tar zxvf nvp-ovs-*.gzyum 
# install kmod-openvswitch-*.rpm  openvswitch-*.rpm

Personally in my lab I also disabled SELinux and IPTables as I was not sure what they would do to KVM.

Edit /etc/selinux/config and set SELINUX=disabled
# chkconfig iptables off
# chkconfig ip6tables of
# service iptables stop
# service ip6tables stop

Edit the udev rules:

vi /etc/udev/rules.d/70-persistent-net.rules 

delete the lines that begin with SUBSYSTEM=="net"

Edit the ethernet device files:

vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/sysconfig/network-scripts/ifcfg-eth1
comment out the line that starts with HWADDR=

Once you have updated and rebooted follow the standard operating procedure to install VMware Tools on this Linux Virtual Machine, and at this point you can shutdown and clone the Virtual Machine to a Template and re-clone to a new Virtual Machine.

One comment

Leave a Reply

Scroll To Top
%d bloggers like this: