WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Automating silent installation of VMware Tools on Linux w/Automatic Kernel Modules

Automating silent installation of VMware Tools on Linux w/Automatic Kernel Modules

06.17.2015 by William Lam // 14 Comments

There was a recent question that was posted internally looking for a way to automate the silent installation of VMware Tools for Linux guest operating systems which also required enabling additional VMware Tools features like VMware's Automatic Kernel Modules. Currently, there are two options of installing VMware Tools for Linux guests, the first is by using VMware Tools Operating Specific Packages (OSPs) which can be found here or you can be manually install VMware Tools if an OSP does not exist or if you prefer to install interactively.

The second approach is what we will be focusing on and specifically with an emphasis on Automation 🙂 Once the VMware Tools installer is extracted, you will find a Perl script that does the actual magic called vmware-install.pl

Screen Shot 2015-06-17 at 8.13.19 AM
The VMware Tools installer supports two modes of installation:

  1. Interactive
  2. Unattended with VMware defaults

The second option sounds like what we want but the problem is that the defaults have already been pre-selected by VMware and they can not be changed as far as I know. To use this option, you would specify the following:

./vmware-install.pl -d default

Here is a complete working snippet that I shared awhile back which will completely automate the installation of VMware Tools using the "default" method and is the quickest way to install VMware Tools for Linux guestOSes:


mkdir -p /mnt/vmw-tools && mount /dev/cdrom /mnt/vmw-tools && VMW_TOOLS=$(ls /mnt/vmw-tools/ | grep .gz) && cp -f /mnt/vmw-tools/${VMW_TOOLS} /tmp/ && umount /mnt/vmw-tools && rmdir /mnt/vmw-tools && tar -zxvf /tmp/${VMW_TOOLS} -C /tmp/ && cd /tmp/vmware-tools-distrib/ && ./vmware-install.pl -d default && rm -rf vmware-tools-distrib/ && rm -f /tmp/${VMW_TOOLS} && cd ~

view raw

gistfile1.txt

hosted with ❤ by GitHub

The solution above is great if you are okay with the defaults. However, if you wish to change any of the default settings such as the location of the installation or enabling additional VMware Tools capabilities, it is definitely not ideal. Unfortunately, as mentioned earlier these are the only two supported installation mechanisms. Now, just imagine you need to roll out a custom installation of VMware Tools and having to perform the installation manually, there must be a way right?

Luckily, there is and this is actually a trick that I have used for many installers which require some user interaction. Below is an updated script of performing a silent installation of VMware Tools, but instead of using the defaults I have created an "answer" file which contains the input that you would manually enter and redirecting that into the installer. In this particular case, I have left the system defaults in terms of the paths and documentation of where VMware Tools will be installed and focus on enabling additional capabilities such as VMware automatic kernel modules.

The last four lines in the answer file (no, no, yes, no) maps to the following VMware Tools capabilities:

  • VMware Host-Guest Filesystem
  • vmblock enables dragging or copying files
  • VMware automatic kernel modules
  • Guest Authentication

You can change these based on your requirements but the current script only enables "VMware automatic kernel modules". I think a great feature enhancement to the VMware Tools installer is the ability to accept a silent configuration file, so that this use case can be better supported and more resilient in case additional options are added.


#!/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 ~

view raw

gistfile1.sh

hosted with ❤ by GitHub

More from my site

  • Quick Tip - Suppress in-guest VMware Tools update notifications
  • Quick Tip - Using PowerCLI to query VMware Tools Configuration at scale 
  • New detailed GuestOS data in vSphere 8.0 Update 2
  • Enhancements to VMware Tools 12 for Container Application Discovery in vSphere 
  • Installing VMware Tools on Raspberry Pi OS for ESXi-Arm

Categories // Automation, ESXi, vSphere Tags // linux, vmware tools

Comments

  1. *protectedJoshua Roskos says

    06/17/2015 at 3:47 pm

    Can this be applied to Darwin (MacOSX) as well?

    Reply
    • William Lam says

      06/17/2015 at 4:48 pm

      The same concept *should* be applicable but I believe that the Mac OS X VMware Tools uses a different installation mechanism, not something I've looked into but you should be able to inspect the installer the same way

      Reply
      • William Lam says

        06/18/2015 at 5:38 pm

        It doesn't look like VMware Tools for Mac OS X provide additional options for installation. However, it can be automated and you can find more details here http://www.virtuallyghetto.com/2015/06/automating-installation-of-vmware-tools-for-mac-os-x.html

        Reply
      • *protectedGhoster says

        02/14/2016 at 7:15 pm

        cause macs are for noobs ;p

        Reply
  2. *protectedFred says

    06/18/2015 at 6:03 pm

    Isn't apt-get install open-vm-tools easier?

    Reply
    • William Lam says

      06/18/2015 at 7:15 pm

      Yes, as mentioned if OSP exists and you wish to use that, then it would be. The article is highlighting the fact that an OSP may not exists or if you wish to use the VMware Tools distributed with vSphere, then here's how you can automate it.

      Reply
      • *protectedStu Duncan says

        06/22/2015 at 2:05 pm

        Also, using VMware Update Manager, you know all your VMware tools are up to date at a glance. Not so with open-vm-tools.

        Reply
  3. *protectedJason says

    02/11/2016 at 6:34 am

    Any thoughts around using the upgradeTools_Task() method to upgrading VMware Tools on Linux (RHEL) machines? (standard upgrade - no OSPs) -- for a silent install, any particular switches one can use? Thanks

    Reply
  4. *protectedArunabha says

    05/29/2016 at 7:11 am

    Hi! William, can you give an idea about virtual machine guest authentication use case with an live example. I understand that certain tasks like VMware tools upgrade can be performed. But how I can leverage the functionality?

    Reply
  5. *protectedArunabha says

    05/29/2016 at 7:14 am

    Hi! Kindly share about how VMCI controller we can use?

    Reply
  6. *protectedArunabha says

    05/29/2016 at 7:17 am

    Hi! William, can you give an idea about virtual machine guest user mappings use case with an live example. I understand that certain tasks like VMware tools upgrade can be performed. But how I can leverage the functionality?

    Reply
  7. *protectedHemant says

    08/31/2016 at 6:08 am

    Great Script ! But this script work for SUSE OS ?

    Reply
  8. *protectedshivanand says

    06/20/2018 at 1:42 am

    can we select Interactive Upgrade Tools Options using Vsphere API.
    Or is there any option in upgradeTools_Task() API to do so.

    Reply
  9. *protectedpete Seger says

    09/22/2018 at 12:09 pm

    so how do i get the script file copied onto the VM? copy & paste dont work.

    Reply

Leave a Reply to FredCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...