This is more like a quick note for myself that I can easily reuse when I want to use VMWare Tools instead of the open source variety. It can also be used to upgrade an older VMWare Tools to the latest version. Prerequisite is that you right click the VM and select Install/Upgrade VMWare Tools so it mounts the .iso image with the VMWare Tools on it to the CD drive of the VM. Make sure a previous other ISO wasn't mounted. If asked which mode to use select Interactive. Then copy and paste the following stuff as root in SSH session or on console of the VM, running as root user or with root privileges. After that, give the machine a reboot so it'll all load up smoothly.
Note regarding open source VM tools
Since ESXi 6.0 it is supported to use the open source open-vm-tools package on Linux operating systems. This works fine for things like shutting down the VM gracefully and restarting it, but it will show up as a question mark in the 'VMWare Tools' status on the virtual machine. You can still use the VMWare Tools instead, but you may get a message that informs you of the possibility to use the open source tools instead, which may interrupt the copy and paste commands mentioned below. In such a case you can execute commands one by. They're separated by the ; character.
Debian 5+, Ubuntu 8+
mkdir /media/cdrom;mount /dev/cdrom /media/cdrom;apt-get -y install tar eject make gcc linux-headers-$(uname -r);cd /tmp;tar xzf /media/cdrom/VMwareTools*.tar.gz;cd vmware-tools-distrib;./vmware-install.pl --default -f || ./vmware-install.pl --default
CentOS 4+, Fedora, RHEL
mkdir /mnt/cdrom;mount /dev/cdrom /mnt/cdrom;yum install tar eject make gcc kernel-devel -y;cd /tmp;tar xzf /mnt/cdrom/VMwareTools*.tar.gz;cd vmware-tools-distrib;./vmware-install.pl --default -f || ./vmware-install.pl --default;umount /mnt/cdrom
Note that if you're on CentOS 7, you may need to install the package 'net-tools' first, because VMWare Tools seems to REQUIRE the program ifconfig which is not present by default. The command yum install net-tools should fix that.
I updated the guide to include the -f flag which stands for force-install. This means that it will install VMWare tools even if the alternative open-vm-tools is available. Some people just prefer to use the VMWare tools instead of the open source alternative.