My lab was recently given a fairly decent modern server to expand the ESX environment we use for development and QA. The only problem with the box is that it had a broken CD drive. Rather than try and dig out an external CD drive to install ESX, I decided to spend the time to figure out how to use PXE to network install it.
First up is to extract the ISO. I copied the ISO to my network boot server and then mounted it as a loop back device.
mount -tiso9660 -o loop,ro VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso /mnt-loop
Then I used rsync to copy the contents of that ISO to my tftp directory. Unlike the network boots of Ubuntu or CentOS which can use HTTP or NFS – the ESX installer will use tftp to get all of the needed files for the install.
rsync -a --include ".*" /mnt-loop/ /srv/tftp/vmware-5.1.0-799733
I then had to add a menu item into the PXE menus. I already had a Utilities sub-menu, so I added this to that menu:
LABEL ESX-5-1-0-799733 Unattended MENU LABLE ESX 5.1.0-799733 Unattended KERNEL vmware-5.1.0-799733/mboot.c32 APPEND -c vmware-5.1.0-799733/boot.cfg ks=http://192.168.100.10/preseed/vmware-5.1.0-799733/unattended.ks TEXT HELP VMware ESX 5.1.0-799733 Unattended Install ENDTEXT
You will see a reference to a kickstart (ks) file in the APPEND section. This is a simple kickstart file to make the install an unattended one. It needs to be hosted on a web server the server can get to while it is booting. The contents of my file look like this:
accepteula install --firstdisk --overwritevmfs rootpw password network --bootproto=dhcp --device=vmnic0 reboot
There is one last step. In the extracted ISO directory (/srv/tftp/vmware-5.1.0-799733 in this example), you need to modify the boot.cfg file. The paths of the on-disk version need to be updated. A leading “/” needs to be removed. This sed command will do that for you:
mv boot.cfg boot.cfg.orig cat boot.cfg.orig | sed -e "s#/##g" > boot.cfg
In addition, the on-disk version of that file is missing one line. Add this line below the “title=” line:
That needs to match the directory name that the ISO was extracted into.
That is your network install server configuration. All that is left to to is to kick off a network install on your new VM server, pick the ESX installer from the menu and let it finish.
When you are done, you have a server using DHCP with the ESX root password of “password”. Do your post installation configuration- setting a static IP, reset the password, and connect up your additional network cables. Then join it to your vCenter and you are ready to start using VMs.