Automated ESXi 6.7 U2 Zero Touch Install via USB
Almost zero-touch, after you create a file
Having a homelab shouldn’t revolve around installing ESXi, it should be about what you do on top of it.
In fact, installing ESXi should be painless, automated, and trivial.
I’ll cover how to create a bootable USB that will install ESXi unattended. The USB will auto-install onto itself; making it the boot disk afterwards.
Unlike a local disk or SAN LUN, USB/SD devices are sensitive to excessive amounts of I/O as they tend to wear over time. This naturally raises a concern about the life span of the USB/SD device. When booting from USB/SD keep in mind that once ESXi is loaded, it runs from memory and there is very little ongoing I/O to the boot device. The only reoccurring I/O is when the host configuration is routinely saved to the USB/SD device, which by default is done once every 10 minutes. Based on how often you reboot the host and install patches it is expected that a good quality USB should last for several years. source
This is a repeatable process for fearless homelab ESXi installs while preserving any existing local VMFSs. If previous VMFSs exist, you can always clean them up after ESXi is running for a fresh slate.
Table of Contents
- ESXi server
- USB drive (reliability is more important than size over 1GB)
- Linux PC (like Ubuntu) with USB port
The USB that you use to provision ESXi will install the OS on itself. Meaning, after you prep the USB stick and plug it in, it will become your ESXi boot disk. Forever.
This can be modified in the
ks_cust.cfg at your own risk.
Get VMware ISOs
Using EVALExperience to download ISOs
There’s a detailed walkthrough at tinkertry.com. After signing up for EVALExperience proceed.
- Login to vmug.onthehub.com
- Find VMware vCloud Suite Standard 7
- Click Add To Cart and Checkout
- Save the 2 keys that are provided:
VMware vCloud Suite Standard 7 (English) - Download Activation Code: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX Serial Number: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
- Download ISOs for ESXi and vCenter
Create a bootable USB
I’m using a Sandisk 8GB USB 3.0 drive, but any similar drive should work.
Identify the USB disk path
This step may require root (
sudo su -)
It helps to double check the size from another source for comparison. Accuracy is crucial!
As you can see above, I will use
/dev/sda as MY USB location, please validate YOUR USB location.
Make sure the USB device is unmounted.
umount /dev/sda # ignore if not mounted
Create a partition table
dto delete partitions until they are all deleted.
nto create primary partition
- Set default
1that extends over the entire disk.
- Take default sector ranges too.
- Set default
tto set the type to an appropriate setting for the FAT32 file system
pto print the partition table.
Disk /dev/sda: 7.5 GiB, 8004304896 bytes, 15633408 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0xb2521ac2 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 15633407 15631360 7.5G c W95 FAT32 (LBA)
wto write the partition table and quit.
Format the USB (FAT32)
/sbin/mkfs.vfat -F 32 -n USB /dev/sda1
If you have issues, make sure the partition and volume are unmounted (
umount /dev/sda && unmount /dev/sda1)
Install the SYSLINUX bootloader
SYSLINUX is a suite of lightweight master boot record boot loaders. We’ll use it to prep the ESXi USB.
The locations of the
syslinux executable file and the
mbr.bin file might vary. If you are running Ubuntu, you most likely have it already.
Check if you have the
which syslinux # expected: /usr/bin/syslinux
Check if you have the
mbr.bin file by running the following one-liner.
[ -e "/usr/lib/syslinux/mbr/mbr.bin" ] && echo "file is present" || echo "file does not exist" # expected: file is present
If above conditions are met, proceed.
syslinux /dev/sda1 cat /usr/lib/syslinux/mbr/mbr.bin > /dev/sda
Mount the USB
mkdir /usbdisk mount /dev/sda1 /usbdisk
Mount the ESXi ISO
mkdir /esxi_cdrom mount -o loop VMware-VMvisor-Installer-6.7.0.update02-13006603.x86_64.iso /esxi_cdrom
Make sure to replace the ISO with the proper version (above).
Copy the ISO contents to the USB
cp -r /esxi_cdrom/* /usbdisk
mv /usbdisk/isolinux.cfg /usbdisk/syslinux.cfg
syslinux.cfg file, edit the
APPEND -c boot.cfg line to
APPEND -c boot.cfg -p 1.
Start with my personal template and edit to taste.
curl -L -o ks_cust.cfg https://gist.githubusercontent.com/jimangel/5c54b35fa7a4d5791172ced3c08ea8d7/raw nano ks_cust.cfg
Alternately, copy / edit and paste this template to
ks_cust.cfg in your working directory.
For more ideas of what’s possible, see VMware’s documentation.
ks_cust.cfg to the USB
cp ks_cust.cfg /usbdisk
boot.cfg file, edit the
kernelopt=runweasel line to
After you’re complete, unmount the flash drive
umount /usbdisk and the ISO
Boot the ESXi host
Insert the USB stick in the powered down ESXi server and turn it on. You may need to configure your BIOS to boot from USB (or select it from a menu).
Once the USB drive loads, you will see it auto-configuring ESXi.
- Find IP of ESXi host either via GUI or other methods.
- Navigate to
https://xxx.xxx.xxx.xxx/ui/#/loginand login using
rootand your password set earlier (
At this point you can modify the ks scripts even further. You could also create duplicate copied USB sticks for multiple hosts.