Install VMware Tools in CentOS using yum
When running CentOS (or RHEL, or Scientific Linux) in a VM on VMware ESXi, you may want to install VMware Tools. Modern Linux distributions include the drivers necessary to run the OS in a VM on VMware ESXi, even those for PVSCSI controllers and VMXNET3 NICs. Although there is no longer a need to install extra drivers, VMware Tools should still be installed to enhance management of the VM through vSphere Client. yum makes installing VMware Tools extremely simple.
I prefer using yum to install the VMware Tools primarily because ISO install procedure is a hassle. This procedure, as explained in Mastering VMware vSphere 5 has over ten steps! Basically, you have to download the ISO, attach it to the VM, mount it in the VM, extract the tarball, run the vmware-install.pl script, and follow the instructions. Additionally, with the ISO method, the package manager won’t manage the software, and installing future updates is no easier than the initial install. Using the yum package manager is easier and a better solution overall.
To install VMware Tools with yum, it must be configured with a repository containing the necessary packages. VMware conveniently provides repositories for common Linux distributions, which can be found here:
There are three easy steps to configure yum and install VMware Tools.
1. Determine the location of the repository for the version of ESXi and CentOS you are using.
Browse through the directories at the above link until you find the location of the appropriate repository. For example, if you are using ESXi 5.0 update 1 and CentOS 6.x, the following location contains the 32- and 64-bit repositories:
2. Configure yum by creating a *.repo file.
yum repositories are configured in plain text files in the /etc/yum.repos.d/ directory. If this doesn’t sound familiar I suggest reading a good book about RHEL or CentOS such as RHCSA/RHCE Red Hat Linux Certification Study Guide. Besides providing tons of great information it can help prepare for the well-respective RHCSA and RHCE certifications. In any case, the repository can be configured with minimal options, but in the sake of security you ought to enable GPG signature checking of the repository’s repodata and packages. With the correct configuration, no extra administrative effort is required. Create a *.repo file (e.g. /etc/yum.repos.d/vmware.repo) with the following configuration:
[VMware] name=VMware Tools baseurl=http://packages.vmware.com/tools/esx/5.0u1/rhel6/$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
Be careful about the formatting. An indentation (one or more spaces) before the URL for the second GPG key is actually required. Or, simply copy the following and paste it in a bash prompt to do all of the above (edit it for your version of CentOS and ESXi, if necessary).
cat > /etc/yum.repos.d/vmware.repo << EOF [VMware] name=VMware Tools baseurl=http://packages.vmware.com/tools/esx/5.0u1/rhel6/\$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub EOF
Below is a screen shot demonstrating this.
3. Use yum install to install VMware Tools and plugins.
If the previous steps were done correctly, the last step is simple. All that’s necessary is to run the following command:
yum install vmware-tools-services vmware-tools-plugins-guestInfo vmware-tools-plugins-powerOps
You will be prompted to import GPG keys and to confirm the packages to install, and a few required dependencies will be be installed. This command includes a plugin that “provides guest information to the virtual host” such as the IP address, and one that enables “soft power operations.” Personally I find these useful but you can omit them if you prefer. There are other plugins and meta packages that install all relevant packages for servers (vmware-tools-esx-nox) and desktops (vmware-tools-esx).
Before running the above, the Summary tab in vSphere client shows VMware Tools as “Not running (Not installed)”.
And after, VMware Tools are shown as “Running (3rd-party/Independent)”.
Using these three steps, installing VMware Tools on CentOS with yum is quick and easy. If you upgrade ESXi, modify the *.repo file to point to the new repository and run yum update to get the latest VMware Tools. In vSphere 5.0, 5.0 update 1, and 5.1, the package naming has been consistent, but if the names do change after and upgrade, simply remove the old packages (yum erase <package_name>) and install the new ones.