Last active
June 28, 2022 09:18
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
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
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