Friday, January 11, 2013

Install official VMWare-Tools via yum repository for RedHat and CentOS


Edit: RHEL 7 and CentOS 7 now officially recommends open-vm-tools via their own repository -- i.e. sudo yum -y open-vm-tools , then reboot -- that is all!  If you are still using RHEL/CentOS 5 or 6, then continue below:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(Sources: http://packages.vmware.com/tools/docs/manuals/index.html)

All instructions assuming root or sudo.

Special Note: May have to remove old versions prior to upgrades:
vmware-uninstall-tools.pl  or
rpm -e VmwareTools or
yum remove vmware-tools[-esx] or ..?..


First, add gpg keys for repositories:
wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub
wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
rpm --import ./VMWARE-PACKAGING-GPG-RSA-KEY.pub
rpm --import ./VMWARE-PACKAGING-GPG-DSA-KEY.pub


Adding the appropriate sources depend on Release-Version and Architecture:

(Tools version can be 4.0latest, 4.1latest, 5.0latest, or 5.1latest)
(Release can be rhel5 or rhel6)
(Architecture can be i386 or x86_64)

***** edit: Thanks to Anonymous (Nov 1 2013), please do not use "*latest" as VMWare now recommends the static url/folder.  Ex: "5.1u3". Find yours by traversing http://packages.vmware.com/tools/esx/ 
***** edit: As of Early 2014, I find "*.latest" is still working with ESXi 5.1 and CentoOS 6.5 -- proceed at your own discretion.

Confirm your distro with cat /etc/redhat-release

Confirm your architecture with uname -m (or -a) (if i686, use i386)

Create the repository file /etc/yum.repos.d/vmware-tools.repo and edit it to contain the following, based on the above confirmations and desired vmware version:
(your baseurl will be http://
packages.vmware.com/tools/esx/<version>/<release>/<architecture>)
(note various examples are commented with #)
----------------------------------------------------------------------------------------------
[vmware-tools]
name=VMware Tools

baseurl=http://packages.vmware.com/tools/esx/5.1latest/rhel6/x86_64
#baseurl=http://packages.vmware.com/tools/esx/5.1latest/rhel6/i386
#baseurl=http://packages.vmware.com/tools/esx/5.1latest/rhel5/i386
#baseurl=http://packages.vmware.com/tools/esx/5.1latest/rhel5/x86_64
#baseurl=http://packages.vmware.com/tools/esx/4.0latest/rhel6/x86_64
#baseurl=http://packages.vmware.com/tools/esx/4.0latest/rhel5/i686
#baseurl=http://packages.vmware.com/tools/esx/4.0latest/rhel6/i686
enabled=1
gpgcheck=1

----------------------------------------------------------------------------------------------
 

Installation for VMWare 4.x tools (option 1 or 2 exclusively):
option 1) 4.x including X11 dependencies:
yum install vmware-tools
option 2) 4.x excluding X11 dependencies (headless):

yum install vmware-tools-nox

Installation for VMWare 5.x tools:
Step 1) Confirm PAE or not (if not PAE, will not see it):
uname -a


Step 2) Install kmods: (option 1 or 2 exclusively)
Option 1) non-pae:
yum install vmware-tools-esx-kmods
Option 2) pae:
yum install vmware-tools-esx-kmods-PAE

Step3) Install tools: (option 1 or 2 exclusively)
Option 1) including X11 dependencies:
yum install vmware-tools-esx
Option 2) excluding X11 dependencies (headless):
yum install vmware-tools-esx-nox

Note, This can be done in one line, but "kmods" must be FIRST
yum install vmware-tools-esx-kmods[-kerneltype] vmware-tools-esx[-nox]
where [-kerneltype] is "-PAE" or nothing and "-nox" or not.

Therefore, this is the no pae, no X (headless) install command:
yum install vmware-tools-esx-kmods vmware-tools-esx-nox


-------------

13 comments:

  1. Hello Steronius,
    Thanks to your guide, I've used:
    baseurl=http://packages.vmware.com/tools/esx/5.1latest/rhel6/x86_64
    for my CentOS release 6.4 (Final) x86_64 which runs on ESXi 5.1 and it worked like a charm.

    This is the best guide ever for VMWare tools, thank you, thank you and thank you from my heart and best wishes!

    ReplyDelete
    Replies
    1. +1. Well done, thanks so much. Perfect on 5.0u3 as well.

      Delete
  2. Wanted to let you know that your instructions are somewhat off. VMware has stated themselves that you should not be using repo locations pointed at /*latest/ locations, but should point your repo file at specific locations. As an example, to point at the latest 5.1 toolset for each respective OS in your above example, your sample repo file should look like:

    [vmware-tools]
    name=VMware Tools
    #baseurl=http://packages.vmware.com/tools/esx/5.1p03/rhel5/i386
    baseurl=http://packages.vmware.com/tools/esx/5.1p03/rhel5/x86_64
    enabled=1
    gpgcheck=1

    VMware themselves have stated:

    "If you are reading this, then its because you tried to use the rhel5 or rhel6 symlink under the *latest directory (or you are very curious). We have disabled these links due to known bugs during the upgrade process. Please use the release directories instead of the *latest directories to access the OSPs for RHEL 5 and 6.

    Please see the engineering release note in the docs directory
    (/docs/engineering-release-notes/rhel-upgrade) for more details.

    Thanks."

    ReplyDelete
  3. Thank you Anon! ...when did that change :P ....

    ReplyDelete
  4. Anonymous, it seems that is only true for "5.0latest" on RedHat/CentOS version 5.0 and 6.0, not 5.1+ nor 6.1+. :

    reference: https://github.com/razorsedge/puppet-vmwaretools/blob/master/TODO

    ReplyDelete
  5. It is true for every version/update of 5.0 and 5.1, both RHEL 5 and 6. I don't know about vSphere 5.5, as we aren't running it yet because of other software incompatibilities.

    ReplyDelete
    Replies
    1. I concur; I witnessed my first issue yesterday. I had to use the static folder /5.1p03/ ... This is not as manageable as "*latest" unfortunately.

      Delete
    2. For what it's worth, I took issue with the inability to have a manageable "latest" structure so that if you did a yum update you could just get the latest vmtools update, and asked that they re-think having to have a specific patch-level indication in the yum repo path/description. So, I'm going to open a different ticket with them to hopefully remedy this issue. I told them if they didn't want people using the "latest" path, they shouldn't even expose it to customers. They agreed with that advice/sentiment.

      Delete
  6. Hello again,

    How do I uninstall, this doesn't work: "yum remove vmware-tools-esx" nor "yum remove vmware-tools-esx-kmods"

    ReplyDelete
    Replies
    1. First, edit /etc/yum.repos.d/vmware-tools.repo to contain the original repo you tried, then
      yum -y remove vmware*
      rm -f /var/cache/yum/vmware-tools/repomd.xml
      rm -r -f /etc/vmware-tools
      rm -r -f /usr/lib/vmware-tools

      Edit /etc/yum.repos.d/vmware-tools.repo to contain the new repo, or if preferred, delete it altogether.

      Delete
  7. worked for me :) Thanks a lot Steronius!!

    ReplyDelete
  8. For CentOS fans! Here is Step-by-Step CentOS 7 Installation in VMware Workstation.

    https://www.youtube.com/watch?v=i47RoWzqgng

    Made for Open Source community and hope it helps somebody.

    ReplyDelete

Comments, Suggestions or "Thank you's" Invited!