Home > VMWare > Modifying an ESXi ISO to reduce the number of keypresses required for build

Modifying an ESXi ISO to reduce the number of keypresses required for build

Modifying an ESXi ISO to reduce the number of keypresses required for build

There are several tools available for quickly deploying ESX / ESXi ( I am reviewing these in my ESX to ESXi ‘Upgrade’ series.

But the vanilla config for each of these still requires a coule of manual key presses – ting is, do we really need a welcome screen and a second confirmation of everything we do? Assume for example I have 20 ESX hosts, ready to build, but networking is not yet in place because as usual the Networks team are dragging their heels . .so I decide to take the 20 boxes and drop ESXi on them. I am happy (in this case) to ISO boot them, but do not want to click ‘Next -> Next -> Next  -> Next -> finish’ (If I wanted to do that I would have installed Windows?

Anyway, the way to modify this is to crack open the python script that VMware uses for installation.

  1. First of all, we are installing from an ISO, so let’s crack open the ISO (the easiest way to do this is just mount it to a VM. As it is Linux based, I figure a Linux VM is best) – A quick tip here – it is always handy to keep a linux based VM around for general maintenance. I use the VMware browser appliance which is simply an Ubuntu Linux workstation http://www.vmware.com/appliances/directory/80 – anyway, mount your ESXi  ISO and open it up
  2. The content looks like this:  If I were a gambling man I’d guess that we need to modify the install.tgz file?
  3. OK, so as we are doing this from within Ubuntu, we could simply double click the file and extract it, but I am going to assume that you may only have a shell from your Linux (or you’re using something like Cygwin) – so let’s open a terminal shell.
  4. Once we have opened a Terminal shell, we’d like to get access to our CDRom (mounted ISO), so we type ‘mount’ to show mounted objetcs. (on the Browser appliance a CDROM appears as : /media/cdrom)
  5. If we go ‘cd /media/cdrom’ and type ‘ls’ the list of files on the CDRom appears (including of course our install.tgz file)
  6. OK, we need to create a work area in which to edit this file so let’s create a temp location ‘mkdir /tmp/install’
  7. Next we need to extract the install.tgz file so that we can edit it ‘tar –C /tmp/install –xzvf /media/cdrom/install.tgz’
  8. If we now browse to the /tmp/install folder we can view a series of extracted files and folders. We need to edit the file called ThinESXInstall.py, we can do this using nano or vi, but it is currectly read only. To change the permissions on the file we type ’chmod 777 /tmp/install/usr/lib/vmware/installer/ThinESXInstall.py’
  9. We’ll use nano. In the terminal session, type :’nano /tmp/install/usr/lib/vmware/installer/ThinESXInstall.py’
  10. About 20 lines into the file you will find a class called ‘ThinESXInstall’, we need to edit the steps in this section.
  11. We know that we do not want to see a welcome screen, we do not want to be prompted for license details, we do not want to be prompted to confirm anything, and we don’t need to know when the installation is complete(the host of course will have an OS on to show us this?), so we can edit the Steps fields as follows:
    1.  Steps = [ WelcomeStep, LicenseStep, TargetSelectionStep, ConfirmStep, \
       WriteStep, PostConfigStep, CompleteStep, RebootStep ] -should become
    2. Steps = [ TargetSelectionStep, \
  12.  WriteStep, PostConfigStep, RebootStep ]
  13. Once you have edited this as you like, simply hit CTRL – X and when prompted select ‘y’, then save the file back to the original location.
  14. We now need to rebuild the install.tgz – at the terminal shell we type ‘cd /tmp/install’ then  ‘tar –czvf /tmp/install.tgz *’ – this will create a new tarball at /tmp/install.tgz.  YOU HAVE DONE THIS IN THE TEMP DIRECTORY – IT WILL BE DELETED AT REBOOT!
  15. We now have a modified install.tgz that simply needs to be replaced in our ISO.
  16. We can copy this Install.tgz file up to a network location (or from our Linux host) using something like WinSCP. As the file is only 21k in size, I simply connect a virtual floppy to the Browser appliance and copy the file to there, then mount it to a windows VM on my network (If your appliance is already on the network, just copy it using the network)
  17. Using your favourite ISO editor (Google UltraIso 9.3 PC Users readers) simply replace the old install.tgz file with your new one. If you now boot from the ISO (or even use it with one of the various PXE server solutions out there (UDA / EDA / V-PXESEERVER etc) – you will suddenly have a bunch fewer prompts at boot.
  18. Mounting this using something like V-PXESERVER, or EDA now returns a 1 button build from PXE (Select storage)
  19. Happy days . . enjoy!
Categories: VMWare Tags:
You must be logged in to post a comment.