Build a custom automated ESXi installer image

Build a custom automated ESXi installer image

by Matt Bradford

If you’re like me, you’ve probably performed more manual ESXi installs than you care to admit. It’s not just the installation of the hypervisor, but the installation of the drivers and other bundles that can easily eat into your busy day. Not to mention if you try to image many hosts at the same time there’s a good likelihood that you’ll miss something that will come back and haunt you later.

One of the benefits of working with a great vendor is that they’re usually willing to ship your hosts pre-imaged and built to your spec. In order to make my vendor’s lives easier I wanted an ISO that would install ESXi to our spec without intervention. I needed to build a custom automated ESXi installer image. It may sound complicated but it’s pretty simple and the best thing is it doesn’t take long. Your first time may take 30 minutes, but once you have everything together you will be able to create the ISO in about five. Here’s how you do it…

Download the ESXi Offline Bundle. You can use the generic or vendor provided image.

download_offline_bundle'

 

Download the driver and other offline bundles you want to pack into your image. Copy everything to a folder. (Note that offline bundles may be inside the zip file you download.)

copy_offline_bundles_to_folder

 

Open PowerCLI and add the ESXi offline bundle.

Add-EsxSoftwareDepot .VMware-ESXi-5.5.0-Update3-3248547-HPE-550.9.4.5.7-Dec2015-depot.zip

add_esxi_offline_bundle

 

Add the driver offline bundles.

Add-EsxSoftwareDepot .hpsa-5.5.0.106-offline_bundle-2734178.zip

add_driver_bundles

We need to get the name of the image by entering…

Get-EsxImageProfile | Select Name

In this case our image name is HPE-ESXi-5.5.0-Update3-550.9.4.5.7.

get-esximagteprofile

We’ll take the name of the profile from the previous step and create a new image with it.

New-EsxImageProfile -CloneProfile HPE-ESXi-5.5.0-Update3-550.9.4.5.7 -Name ESXi-5.5-VMSpot-Customized

By default the acceptance level will be Partner Supported. More info available here.

New-EsxImageProfile

Export the image to an ISO by typing…

Export-EsxImageProfile -ImageProfile ESXi-5.5-VMSpot-Customized -ExportToIso -Filepath .ESXi-5.5.0.VMSpot.iso

Export-To-Iso

Launch WinISO and open the ISO.

WinISO_OpenISO

Create a file called KS_CUST.CFG and add the following…

# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI
rootpw VMwareR0cks!
# The install media is in the CD-ROM drive
installorupgrade --firstdisk --overwritevmfs
# Set the network to DHCP on the first network adapter
network --bootproto=dhcp --device=vmnic0
# reboots the host after the scripted installation is completed
Reboot

Create_KS_CUST_CFG

Copy BOOT.CFG from the ISO and change the kernelopt line as such…

kernelopt=runweasel ks=cdrom:/KS_CUST.CFG

modify_boot_cfg_one_line

Add the KS_CUST.CFG file to the root of the ISO and overwrite BOOT.CFG. Save the ISO.

Add_Files_To_Iso

Mount the ISO to your host and boot.

Mount_the_ISO

The installation process will now run without any manual intervention.

Boot_Menu

Loading_Custom_Installer

Reading_Installation_Script

It’s okay to ignore the DHCP warning. It will clear automatically after a few seconds.

DHCP_Warning

writing_first_boot_scripts

The installation is finished! The host will now reboot automatically!

system_finished_upgrading

(Courtesy of VMSpot)


VMware Social Media Advocacy

Leave a Reply

Your email address will not be published. Required fields are marked *