Skip to content

Instantly share code, notes, and snippets.

@ilanh
Last active June 28, 2022 09:18
Show Gist options
  • Save ilanh/da30692e33d5796f813d451031453be2 to your computer and use it in GitHub Desktop.
Save ilanh/da30692e33d5796f813d451031453be2 to your computer and use it in GitHub Desktop.
Install VMware Tools to linux virtual machines, first run will uninstall open-vm-tools, second run will install tools. (ubuntu, debian, centos, redhat)
#!/bin/bash
# you can run it directly from console using:
# curl -L -s https://gist.github.com/ilanh/da30692e33d5796f813d451031453be2/raw/ | sudo -H sh
if lsblk -fp | grep iso9660 | grep 'VMware Tools' ; then
echo "Found Tools CD";
else
echo "Tools CD not found!";
echo "Removing open-vm-tools";
if [ -f /etc/redhat-release ]; then yum remove -y open-vm-tools; fi
if [ -f /etc/lsb-release ]; then apt remove open-vm-tools --purge -y ; fi
echo "Now go back to vSphere, refresh and choose: Install VMware Tools";
echo "When prompted choose: Mount";
exit 1;
fi
cd /tmp
rm -rf vmware-tools-distrib/
mount /dev/cdrom /media/
tar -xzf /media/VMwareTools-*.tar.gz
umount /media/
eject
if [ -f /etc/redhat-release ]; then
yum remove -y open-vm-tools
yum -y install perl net-tools wget screen
fi
if [ -f /etc/lsb-release ]; then
apt update -y
apt remove open-vm-tools --purge -y
apt install perl -y
fi
cd vmware-tools-distrib/
perl vmware-install.pl -d -f
@ilanh
Copy link
Author

ilanh commented Aug 4, 2019

To run this script from command line, paste the following command to your terminal:
curl -L -s https://gist.github.com/ilanh/da30692e33d5796f813d451031453be2/raw/ | sudo -H sh
To run this script locally, type the following commands:
wget https://gist.github.com/ilanh/da30692e33d5796f813d451031453be2/raw/vmware-tools-install.bash
chmod a+x ./vmware-tools-install.bash
sh vmware-tools-install.bash

@gtrooper
Copy link

To run this script from command line, paste the following command to your terminal:
curl -L -s https://gist.github.com/ilanh/da30692e33d5796f813d451031453be2/raw/ | sudo -H sh
To run this script locally, type the following commands:
wget https://gist.github.com/ilanh/da30692e33d5796f813d451031453be2/raw/vmware-tools-install.bash
chmod a+x ./vmware-tools-install.bash
sh vmware-tools-install.bash

This is really helpful ! A huge thanks ! Do you know what needs to be changed to make this script work in an Arch-based distro ? It does not run in KaOS and Endeavour OS. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment