This week I helped to answer a few questions about creating your own ESXi 5 bootable ISO along with automatically using a static IP Address when the custom ISO first boots up. Although all this information is available via the vSphere documentation, it may not always be easy to put all the pieces together and thought I share the steps for others to also benefit.
You will need access to a UNIX/Linux system and a copy of the base ESXi 5 ISO image. In this example I will be using VMware vMA and VMware-VMvisor-Installer-5.0.0.update01-623860.x86_64.iso and walk you through two different configurations. We will also be referencing the vSphere documentation Create an Installer ISO Image with a Custom Installation or Upgrade Script and Kernel Boot Options.
Create ESXi 5 Bootable ISO w/Remote ks.cfg:
In this configuration, we will create a custom ESXi ISO that will boot with a static IP Address and use a remote ks.cfg (kickstart) configuration file.
Step 1 - Mount base ESXi ISO using the "mount" utility:
$ mkdir esxi_cdrom_mount
$ sudo mount -o loop VMware-VMvisor-Installer-5.0.0.update01-623860.x86_64.iso esxi_cdrom_mount
Step 2 - Copy the contents of the mounted image to a local directory called "esxi_cdrom":
$ cp -r esxi_cdrom_mount esxi_cdrom
Step 3 - Unmount the ISO after you have successfully copied it and change into the esxi_cdrom directory
$ sudo umount esxi_cdrom_mount
$ cd esxi_cdrom
Step 4 - Edit the boot.cfg and specifically the "kernelopt" line to not use the weasel installer but kickstart and also specifying the remote location of your ks.cfg. To get more details on the various kernel boot options, please take a look at the vSphere Boot Options documentation above.
You will also need to specify the static IP Address you wish to have the host automatically use when the ISO first boots up on the same line.
Step 5 - Once you have finished your edits and saved the boot.cfg, you will now change back to the parent directory and use the "mkisofs" to create your new bootable ISO. In this example, we will name the new ISO "custom_esxi.iso":
$ sudo mkisofs -relaxed-filenames -J -R -o custom_esxi.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table esxi_cdrom/
You now have a new bootable ESXi 5 ISO called "custom_esxi.iso" which will now automatically boot up with the specified static IP Address and install based on the ks.cfg that was specified.
Create ESXi 5 Bootable ISO w/Local ks.cfg:
Similar to the above configuration, we will create a custom ESXi ISO that will boot with a static IP Address but use a local ks.cfg (kickstart) configuration file that will be included within the custom ISO.
Step 1 through 3 is exactly the same as above
Step 4 - By default, a basic ks.cfg is included in the ESXi 5 ISO in /etc/vmware/weasel/ks.cfg and we will create a custom *.tgz file that will include our ks.cfg within the ISO. First off by creating a temporary directory which will be used to store our ks.cfg:
$ mkdir -p temp/etc/vmware/weasel
Step 5 - Copy your ks.cfg file into the temp/etc/vmware/weasel:
$ cp ks_custom.cfg temp/etc/vmware/weasel
Step 6 - Create a *.tgz file containing the path to our ks.cfg using the "tar" utility. In this example, we will called it customks.tgz:
$ cd temp
$ tar czvf customks.tgz *
Step 7 - Copy the customks.tgz from temp directory to your esxi_cdrom directory:
$ cp temp/customks.tgz esxi_cdrom
Step 8 - Change into the "esxi_cdrom" directory and edit the boot.cfg just like the above, but we will be using the "file://" stanza to specify the path to our ks.cfg, static IP Address as well as adding our customks.tgz to the module list to ensure that it loads up which contains the actual ks.cfg file that is called in the boot.cfg.
Step 9 - Same as Step 5 above, you now just need to run the "mkisofs" utility to create your bootable ISO.
You now have a new bootable ESXi 5 ISO called "custom_esxi.iso" which will now automatically boot up with the specified static IP Address and install based on the ks.cfg that is included within the ISO.