Note: This post was originally written for an older version of Ubuntu, but the method was tested and works perfectly under 12.04 LTS.
VMWare is a absolutely wonderful platform, and is really fun to play with. Unfortunately, to get the best performance from Guest machines, you need to install VMWare Tools. This will improve the performance of the Virtual Machine, as well as allow VMWare to perform certain functions (Proper Reboot, Shut down, etc) on your new VM that it would otherwise not be able to do.
Installation of VMWare Tools on Windows based machines are an absolute breeze, but things get slightly more tricky once you want to install on Linux-based systems, especially Server versions without a GUI where you have to use CLI.
This How-To will explain on a detailed step-by-step basis how to install VMWare Tools, with the applicable screen shots where required.
For this tutorial, I start off with a brand new, clean installation of Ubuntu 12.04 Server 64-bit, running inside a VMWare ESX 4.0 Server being managed by vSphere 4.0. This tutorial should however work on most other versions of Ubuntu in the same way.
To make the installation a bit easier, I’ve enabled root login, as explained in my previous post:
If you would prefer not to do that, just add “sudo” in from of all commands shown in this how-to.
As a first step, I also prefer to make sure that the installation is updated with all the latest packages. To do this, issue the following two commands:
Then, just to make sure, that all the new packages are loaded correctly, perform a reboot:
Once the system has completed the reboot, you need to install the relevant compiler tools and Linux Headers that will be required to compile the VMWare Tools installation.
First, install all the required compiler tools:
apt-get install build-essential
Then, install the Linux headers specific to the version of Ubuntu that you have running, by issuing the following command:
apt-get install linux-headers-`uname -r`
Please note that the –>`<– character in the above statement, is the one situated just left of the “1” key on your keyboard.
Just for interest sake: If you run the “uname -r” command by itself, you will get back the Linux Kernel version that you are currently running (Ex: 2.6.32-21-generic-pae). So in effect, for my specific machine, this command is telling Linux to: “apt-get install linux-headers-2.6.32-21-generic-pae”
Copy VMWare Tools
Firstly, you need to mount the VMWare Tools CD Image in the Virtual CD-ROM Drive of your Virtual Machine. This might sound difficult, but it is as easy as choosing VM -> Guest -> Install/Upgrade VMWare Tools
This will insert a CD Image into the Virtual CD-ROM Drive, but the CD will not be mounted in Linux yet. To do this, you need to issue the following commands:
mount /dev/cdrom /mnt/cdrom/
Now that the CD is mounted, you can check the contents, and copy it to the temp folder on your Virtual Machine.
ls -al cp VM*.gz /tmp/
Once you have copied the file, you need to untar (unzip) the compressed file:
cd /tmp tar xvzf VM*.gz
This will take a while to complete.
Once it’s done, you need to change into the VMWare Tools folder, and start the installation script:
cd vmware-tools-distrib/ ./vmware-install.pl
It will come up asking all kinds of questions about folders for specific components. Here you can just accept all the defaults by pressing enter at each question.
For good measure, and to make sure that everything is working, you can just reboot the machine a last time.
This is a good place to shutdown the machine and convert it to a template if you think that you might require more Ubuntu virtual machines in the future.