I was asked if it is possible to create an USB Flash Drive that can install ESXi on a server automatically. ESXi has a Scripted Install feature which allows to put all installation parameters into a Kickstart file to run unattended Installations. This post explains how to create an USB Flash Drive that does unattended ESXi installations. You can plug it into a Server, power it on and ESXi will be installed automatically.
- Create a bootable ESXi Installer USB Flash Drive with Rufus (Howto)
- Navigate to the Flash Drive and open boot.cfg with an editor. Make sure to use an editor that can handle UNIX encoding (PSPad for example)
- Replace kernelopt=runweasel with kernelopt=ks=usb:/ks.cfg
- Create ks.cfg in the root directory of your Flash Drive
- Open ks.cfg with an editor. Creating complex kickstart is out of scope of this post. The only option you need to know is install. The firstdisk flag will install ESXi to the first device, with the following priority:
1 - locally attached storage (local)
2 - network storage (remote)
3 - usb disks (usb)
Be careful to not destroy any data! Remove Shared LUNs and do not use this with Servers that contain data.Copy this to your ks.cfg file. This will install ESXi to the first local disk:
vmaccepteula rootpw vmware install --firstdisk --overwritevmfs network --bootproto=dhcp --device=vmnic0 reboot
- Save and Close
That's it. You can plug in the USB Flash Drive to a Server, power it on and it will be installed automatically. The password for the root user is set to "vmware".
Do you want to install plenty hosts to SD Cards or USB Flash Drives?
Create the required amount of USB Flash Drives or SD Cards but replace the ks.cfg file with:
vmaccepteula rootpw vmware install --firstdisk=usb-storage --overwritevmfs network --bootproto=dhcp --device=vmnic0 reboot
Plug it in and power the server on. It will boot from the media and do an unattended installation to the installation media. (It uses the first USB device - might be an issue when you have more than one USB storages connected.)
Of course, you can also write an own ks.cfg file to deploy servers with your own customized configuration.