Create ESXi Custom ISO
If you are looking for a custom ISO creation process for your own automation purposes, follow the below steps.
You would need the following applications for this process
- Powershell
- mkisofs
- VMware ESXi official ISO
There are following high-level steps to accomplish this requirement
- Prepare the environment by installing the required application and downloading ISO
- Prepare the Kickstart file
- Extract the ISO file to the folder
- Copy the Kickstart file to the root folder in the extract
- Modify BOOT.CFG file
- Create ISO from extract using mkisofs
Please refer details steps as below
Download mkisofs
Mkisofs is not easily available over the internet, you can use the following steps to download the mkisofs.
- Download the latest cdrtfe tools zip file from https://sourceforge.net/projects/cdrtfe/files/cdrtfe/
- Create a new folder called mkisofs_app in any of your preferred location
- Extract ZIP file
- Copy mkisofs.exe to folder mkisofs_app from exacted files, you can locate this file in folder \tools\cdrtools\
- There are dependencies which you would need to copy as well so that tool will work.
- Copy mkisofs.exe to folder mkisofs_app from exacted files, you can locate this file in folder \tools\cdrtools\
- Copy cygwin.ini and cygwin1.dll to folder mkisofs_app from exacted files, you can locate this file in folder \tools\cygwin\
- Now, we can use mkisofs tool for creating ISO
- You can verify the tool by checking version of mkisofs tool
- Open command prompt and navigate mkisofs_app folder
- Run command mkisofs.exe –version
- It will return something like “mkisofs 3.02a10 2021/07/23 (i686-pc-cygwin)” (Note, it will vary based on downloaded version)
Once we have mkisofs tool in place, we can proceed with the customization of ESXi
Prepare the Kickstart file
You can create a KS file based on your requirements as its very infra to infra. VMware has very good documentation for KS file parameters which you can refer – https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-esxi-installation/GUID-51BD0186-50BF-4D0D-8410-79F165918B16.html#GUID-61A14EBB-5CF3-43EE-87EF-DB8EC6D83698
I have created the following sample Kickstart file and saved it as KS.CFG, which you can refer to, and do not forget to replace the values in $$. For example, you can replace “$esxipass$” with an exact encrypted password. If you don’t want to use an encrypted password, you can use the parameter rootpw with a plain password, e.g. rootpw VMware123!
You can generate the encrypted password using the following command
1 |
openssl passwd -6 "VMware123!" |
Sample Kickstart File for ESXi Installation and Configuration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
###Accept the VMware End User License Agreement vmaccepteula ###Set the encrypted root password for the DCUI and Tech Support Mode rootpw-iscrypted $esxipass$ ###wipe exisiting VMFS store # clearpart -alldrives-overwritevmfs ###The install media (priority: local / remote / USB) overwritevmfsnovmfsondisk install $ignoressd$ firstdisk=$firstdisk$ ###nstall -ignoressd firstdisk=local overwritevmfs -novmfsondisk ###Set the network to on the first network adapter network --bootproto-static-device=$vmnic$ -ip=$esxiip$ -netmask=$mask$ -gateway-$gw$ nameserver="$dns1$" -hostname=$hostname$ -addvmportgroup=1 --vlanid=$vl ###Reboot ESXi Host #reboot -noeject # -eject doesnt exist reboot ###Stage 02 Post installation: ###Open busybox and launch commands firstboot-interpreter-busybox ###Enable maintaince mode esxcli system maintenanceMode set e true ###Add secondary DNS. esxcli network ip dns server add server=$dns2$ ######Disable IPv6 support (reboot is required) esxcli network ip set ipv6-enabled=false ##Assign License Key vim-cmd vimsvc/license-set=$licensekey$ ###Start WBEM Service for SFCBD/Watchdog esxcli system wbem set -enable true Reboot |
Extract the ISO file to the folder
Extract the ISO file and put it in the folder, as this is required to modify the BOOT.CFG file. You can extract the ISO using 7ZIP or any other tool. 7ZIP has command-line support as well. In this case, we are extracting the ISO to folder C:\Temp\ESXi8.0
7ZIP
1 |
"C:\Program Files\7-Zip\7z.exe" x -y -o"C:\Temp\ESXi8.0" VMware-VMvisor-Installer-8.0U3-24022510.x86_64.iso |
Copy the Kickstart file to the root folder
Copy KS.CFG file into the folder where we extract the ISO files. In this case, the folder path is “C:\Temp\ESXi8.0”
Modify BOOT.CFG file
Modify the BOOT.CFG file, to pick the kickstart file. Note, there are two BOOT.CFG files we would need to modify.
- Root folder BOOT.CFG
- EFI\BOOT\BOOT.CFG
There are the following changes, we have to update in both BOOT.CFG file.
Current
kernelopt=runweasel cdromBoot
Desired Change
kernelopt=runweasel ks=cdrom:/KS.CFG
Create ISO from extract using mkisofs
Now, it’s time to create ISO from extract. There are multiple tools available for it, but we using mkisofs in this scenario.
Please update the command with your respective file and folder path.
1 |
mkisofs.exe -relaxed-filenames -J -R -o "C:\Temp\custom.iso" -b ISOLINUX.BIN -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -b EFIBOOT.IMG -no-emul-boot "C:\Temp\ESXi8.0" |
Once, ISO is created you can install the ESXi with custom parameters. This way you can create custom ESXi ISO and deploy ESXi with custom parameters. All these tasks can be automated using C# or Python or PowerShell. Note, we would need space as automation will create one ISO for each server but ISO can be deleted after the installation.