Let’s face it: installing VMware ESXi from a CD-ROM or from a USB key is painfully slow. Installing from the network is faster and more flexible. And preparing VMware to be installed from PXE turned out to be very easy.
The ISC DHCP configuration file could look like this:
# cat /etc/dhcpd.conf default-lease-time 86400; max-lease-time 604800; option subnet-mask 255.255.255.0; option broadcast-address 1.0.0.255; option domain-name-servers 1.0.0.1; option domain-name "example.com"; subnet 1.0.0.0 netmask 255.255.255.0 { range 1.0.0.100 1.0.0.254; option routers 1.0.0.2; option ntp-servers 1.0.0.3; } host esx { hardware ethernet 00:aa:bb:cc:dd:ee; fixed-address esx; next-server 1.0.0.4; filename "pxelinux.0"; }
The important bits are in the host esx
section, where PXE boot support is enabled by means of the next-server
and the filename
directive. next-server
specifies the IP address (or DNS name) of the TFTP server to be used to download the PXE boot loader and filename
the file that stores the PXE boot loader code.
Looking inside the TFTP server, we can see that the tftpboot
root directory is very simple: it consists of a standard pxelinux.0
PXE boot loader, a pxelinux.cfg
directory where the configuration files are stored and a directory for all VMware-related files. pxelinux.0
is just part of the syslinux
project. pxelinux.cfg
has to be created by hand. vmware-esxi-4-0-0
contains files copied directly from the VMware ESXi 4 installable ISO image:
# ls -l /tftpboot total 40 -rw-r--r-- 1 root wheel 14776 Sep 18 03:17 pxelinux.0 drwxr-xr-x 2 root wheel 512 Sep 18 03:43 pxelinux.cfg drwxr-xr-x 2 root wheel 512 Sep 18 03:50 vmware-esxi-4-0-0
For all different naming options for configuration files stored under pxelinux.cfg
, check the manual page for pxelinux
or search the Internet. In my case, I just chose 01-${MAC}
where ${MAC}
is the MAC address of the Ethernet interface used to PXE-boot the machine where ESXi is to be installed. In this case, ${MAC}
is 00-aa-bb-cc-dd-ee
.
The contents of the configuration file are in fact a slightly modified copy of the contents of the isolinux.cfg
file from the VMware ESXi 4.0 installable ISO image. The only differences are the default
and label
directives and the adjusted path names for the kernel and modules: all these files live inside their own directory to avoid polluting the tftpboot
root.
# cat /tftpboot/pxelinux.cfg/01-00-aa-bb-cc-dd-ee default esxi label esxi kernel vmware-esxi-4-0-0/mboot.c32 append vmware-esxi-4-0-0/vmkboot.gz --- vmware-esxi-4-0-0/vmkernel.gz --- vmware-esxi-4-0-0/sys.vgz --- vmware-esxi-4-0-0/cim.vgz --- vmware-esxi-4-0-0/ienviron.tgz --- vmware-esxi-4-0-0/image.tgz --- vmware-esxi-4-0-0/install.tgz
The files stored inside the vmware-esxi-4-0-0
directory were copied directly from the VMware ESXi 4.0 installable ISO image, as mentioned above:
# ls -l /tftpboot/vmware-esxi-4-0-0 total 694704 -r--r--r-- 1 root wheel 12730046 Sep 18 03:15 cim.vgz -r--r--r-- 1 root wheel 5818848 Sep 18 03:15 ienviron.tgz -r--r--r-- 1 root wheel 288629638 Sep 18 03:17 image.tgz -r--r--r-- 1 root wheel 21456 Sep 18 03:17 install.tgz -r-xr-xr-x 1 root wheel 47404 Sep 18 03:44 mboot.c32 -r--r--r-- 1 root wheel 46184258 Sep 18 03:15 sys.vgz -r--r--r-- 1 root wheel 16805 Sep 18 03:15 vmkboot.gz -r--r--r-- 1 root wheel 2044368 Sep 18 03:15 vmkernel.gz