Skip to content

Instantly share code, notes, and snippets.

@lamw
Created June 17, 2015 05:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lamw/bae9687faa14c7d7ee18 to your computer and use it in GitHub Desktop.
Save lamw/bae9687faa14c7d7ee18 to your computer and use it in GitHub Desktop.
Automate silent install of VMware Tools including enabling Automatic Kernel Module Update
#!/bin/bash
# Create temp workign directory
mkdir -p /mnt/vmw-tools
# Mount VMware Tools ISO
mount /dev/cdrom /mnt/vmw-tools
# Retrieve the VMware Tools package name from the directory
VMW_TOOLS=$(ls /mnt/vmw-tools/ | grep .gz)
# Copy VMware Tools package to /tmp
cp -f /mnt/vmw-tools/${VMW_TOOLS} /tmp/
# Unmount the VMware Tools ISO
umount /mnt/vmw-tools
# Clean up and remove temp mount directory
rmdir /mnt/vmw-tools
# Extract VMware Tools installer to /tmp
tar -zxvf /tmp/${VMW_TOOLS} -C /tmp/
# Change into VMware Tools installer directory
cd /tmp/vmware-tools-distrib/
# Create silent answer file for VMware Tools Installer
# If you wish to change which Kernel modules get installed
# The last four entries (no,no,yes,no) map to the following:
# VMware Host-Guest Filesystem
# vmblock enables dragging or copying files
# VMware automatic kernel modules
# Guest Authentication
# and you can also change the other params as well
cat > /tmp/answer << __ANSWER__
yes
/usr/bin
/etc
/etc/init.d
/usr/sbin
/usr/lib/vmware-tools
yes
/usr/share/doc/vmware-tools
yes
yes
no
no
yes
no
__ANSWER__
# Install VMware Tools and redirecting the silent instlal file
./vmware-install.pl < /tmp/answer
# Final clean up
rm -rf vmware-tools-distrib/
rm -f /tmp/${VMW_TOOLS}
cd ~
@RAGNOARAKNOS
Copy link

Thats brilliant, is there a means to check whether the linux devheaders are already installed before the installation starts?

@dragon788
Copy link

William, loved your post on this. http://www.virtuallyghetto.com/2015/06/automating-silent-installation-of-vmware-tools-on-linux-wautomatic-kernel-modules.html

I'm actually thinking of incorporating this into https://github.com/rasa/vmware-tools-patches/ if that's OK with you. He has an excellent one touch script that grabs the latest tools and applies just the right patches for your system, and that also includes the kernel headers mentioned by @RAGNOARAKNOS.

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