ESXi5, gPXE boot, ks script install via HTTP

ESXi5, gPXE boot, ks script install via HTTP

ESXi5, gPXE boot, ks script install via HTTP 150 150 Roderick Derks

Howto perform a scripted ESXi 5.0 installation via HTTP and not TFTP? You can find the answer here. And the WHY question? Because HTTP is faster, can handle larger files, does not cost performance of your PXE boot server, and you not limited to your network (via internet is possible too).

For ESXi4 it was fairly easy to install via HTTP. VMware changed this into something more complicated, maybe to promote their integrated installation feature. The VMware vSphere documentation also lacks some information. This is the complete setup:

Install a PXE boot server.

Install the gPXELINUX.0 image:

yum install gpxe-bootimgs find /usr/ -name *gpxe* cp /usr/share/syslinux/gpxelinux.0 /tftpboot/

The DHCP config for Apache:

# pxe boot stuff allow booting; allow bootp; # gPXE options option space gpxe; option gpxe-encap-opts code 175 = encapsulate gpxe; option gpxe.bus-id code 177 = string; class "pxeclients" {   match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";   next-server;     if not exists gpxe.bus-id {     filename "/gpxelinux.0";         } }

Now edit the /tftproot/pxelinux.conf/default file which will be loaded by the gPXE bootloader.

LABEL ESXi 5.0 KickStart and HTTP KERNEL APPEND -c ks= +++ IPAPPEND 1

Then the BOOT.CFG file from the extracted VMware's ISO was edited:

bootstate=0 title=Loading ESXi installer kernel= kernelopt=runweasel #kernelopt=ks= modules= --- --- --- --- --- --- --- ---

I use a Linux webserver, capital sensitive. I had to change all the lowercase letters in the filenames into captials. And mind this: the real filenames are different then the ones named in the vSphere install and configure guide.

Create a ks.cfg file and make it available on your webserver:

accepteula #dryrun install --firstdisk --overwritevmfs #url --url rootpw password reboot network --bootproto=static --ip= --gateway= --nameserver= --netmask= --addvmportgroup=1  %firstboot --interpreter=busybox  # enable HV (Hardware Virtualization to run nested 64bit Guests + Hyper-V VM) #grep -i "vhv.allow" /etc/vmware/config || echo "vhv.allow = \"TRUE\"" >> /etc/vmware/config   # enable & start remote ESXi Shell  (SSH) vim-cmd hostsvc/enable_ssh vim-cmd hostsvc/start_ssh   # enable & start ESXi Shell (TSM) vim-cmd hostsvc/enable_esx_shell vim-cmd hostsvc/start_esx_shell

Good luck.

Alternative approach, same result:

Edit the dhcpd.conf as follows:

allow booting; allow bootp; option option-128 code 128 = string; option option-129 code 129 = text; next-server; #filename "/pxelinux.0";  if ((exists user-class) and (option user-class = "gPXE")) {    filename "";    } else {    filename "undionly.kpxe";    }

Add the php file to the webserver with the following content:

<?php echo "#!gpxe\n"; echo 'chain pxelinux.0' ."\n"; ?>

Add the following files to the webserver:

  • pxelinux.conf/default (pxelinux config file containing the menu)
  • chain.c32
  • menu.c32
  • memdisk

Add the following file to the tftpserver:

  • undionly.kpxe

That should work too.

Roderick Derks

Liefhebber van fietsen, van het oplossen van IT puzzels, en van het delen van informatie om anderen te helpen.

All stories by:Roderick Derks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Your Name (required)

    Your Email (required)


    Your Message

      Your Name (required)

      Your Email (required)


      Your Message