When installing a minimal CentOS 6.4 VM on vSphere 5.1 or later, Perl is not automatically installed. This means you can't install VMware tools and thus the VMXNET3 driver to enable networking. You could change the initial setup of your VM (eg. add the Perl packages during the install of CentOS or install an E1000 adapter in addition to the VMXNet3 adapter) but you might be in the situation that requires a nice clean install. The steps below allow you to retrospectively install Perl and VMware tools.


We're assuming the following about your setup:


  1. The VM was created with a single VMXNET3 adapter
  2. An x64 instance of CentOS 6.4 was installed using the "Minimal" default installation of CentOS
  3. The CentOS 6.4 ISO is still connected to the VM
  4.  You can login as root via the Virtual Machine Console in the vSphere Client
  5. You have a DHCP server on your network


Step 1: Mount the CentOS 6.4 ISO


Ensure the ISO is connected to the VM. Then at the root prompt type:


mount /dev/cdrom /mnt
cd /mnt/Packages


Step 2: Install the necessary Perl packages


Now type using tab command completion (line is wrapped for readability):


yum --disablerepo=* localinstall 
    perl-5.10.1-129.el6.x86_64.rpm 
    perl-libs-5.10.1-129.el6.x86_64.rpm 
    perl-version-0.77-129.el6.x86_64.rpm 
    perl-Module-Pluggable-3.90-129.el6.x86_64.rpm 
    perl-Pod-Simple-3.13-129.el6.x86_64.rpm 
    perl-Pod-Escapes-1.04-129.el6.x86_64.rpm


6 packages should be installed.


Step 3: Unmount the ISO


Now type at the command prompt:


cd
umount /mnt


Step 4: Install VMware Tools


In the Virtual Machine Console go to the VM menu and choose Guest -> Install/Upgrade VMware Tools. Then at the command prompt:


mount /dev/cdrom /mnt
cd /tmp
tar xvzf /mnt/VMwareTools-9.0.5-1137270.tar.gz
cd vmware-tools-distrib
./vmware-install.pl
cd
umount /mnt


Follow the prompts to install VMware Tools. The defaults usually suffice. Remember this only installs VMware tools for the currently running kernel. If you do a yum update you will need to reinstall VMware Tools. Additionally note that the exact VMwareTools tgz will depend on the version of the ESXi hypervisor you are running so you might have to adjust the file name to suit.


Step 5: Check the VMXNET3 driver is loaded


At the command prompt, enter:


lsmod | grep vmxnet


You should see the following similar output - this means the driver is loaded and is unused.


vmxnet3        42862   0


Step 6: Edit the network settings


Now edit the network settings:


vi /etc/sysconfig/network-scripts/ifcfg-eth0


Change your network settings as you see fit but minimally change the following line in ifcfg-eth0 in order to get a DHCP lease:


ONBOOT=yes


Step 7: Restart the network and get a lease


At the command prompt type:


service network restart


The network will restart and you should have an IP address assigned via DHCP. Type:


ifconfig

eth0      Link encap:Ethernet  HWaddr 00:50:56:87:51:A9
          inet addr:10.0.0.163  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fe87:51a9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:338 errors:0 dropped:0 overruns:0 frame:0
          TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:40438 (39.4 KiB)  TX bytes:7155 (6.9 KiB)


That's it! All done.


Addendum from Tristan at Aptira


A reader wrote in with a simpler way, as the VMXNET3 driver is included with CentOS minimal for all 6.x versions.

  1. Install OS
  2. vi ifcfg-eth0 and set ONBOOT=yes
  3. Reboot and the network should come up.
  4. yum -y wget
  5. Grab the latest VMware repo via wget or curl.
  6. rpm -ivh vmware-tools-repo-RHEL6-10.2.1-1.el6.i686.rpm
  7. yum install -y vmware-tools-esx-nox
  8. Profit!