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 10.0.2.11;     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 http://10.0.2.14:8080/vSphere/ESXi_5.0/MBOOT.C32 APPEND -c http://10.0.2.14:8080/vSphere/ESXi_5.0/BOOT.CFG ks=http://10.0.2.14:8080/vSphere/ESXi_5.0/ks.cfg +++ IPAPPEND 1

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

bootstate=0 title=Loading ESXi installer kernel=http://10.0.2.14:8080/vSphere/ESXi_5.0/TBOOT.B00 kernelopt=runweasel #kernelopt=ks=http://10.0.2.14:8080/vSphere/ESXi_5.0/esxi_ksFiles/ks.cfg modules=http://10.0.2.14:8080/vSphere/ESXi_5.0/B.B00 --- http://10.0.2.14:8080/vSphere/ESXi_5.0/USEROPTS.GZ --- http://10.0.2.14:8080/vSphere/ESXi_5.0/K.B00 --- http://10.0.2.14:8080/vSphere/ESXi_5.0/A.B00 --- http://10.0.2.14:8080/vSphere/ESXi_5.0/S.V00 --- http://10.0.2.14:8080/vSphere/ESXi_5.0/WEASELIN.I00 --- http://10.0.2.14:8080/vSphere/ESXi_5.0/TOOLS.T00 --- http://10.0.2.14:8080/vSphere/ESXi_5.0/IMGDB.TGZ --- http://10.0.2.14:8080/vSphere/ESXi_5.0/IMGPAYLD.TGZ

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 http://10.0.2.11/vmware/esxi/5.0/ks.cfg rootpw password reboot network --bootproto=static --ip=10.0.2.100 --gateway=10.0.1.254 --nameserver=10.0.2.11 --netmask=255.0.0.0 --hostname=esxi5.r71.nl --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 10.0.2.11; #filename "/pxelinux.0";  if ((exists user-class) and (option user-class = "gPXE")) {    filename "http://10.0.2.14:8080/gpxe/boot.php";    } 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)

    Subject

    Your Message

      Your Name (required)

      Your Email (required)

      Subject

      Your Message