In the middle of last year, I had a short post detailing booting the ESXi installer. Tom recently asked how one would PXE boot and kickstart the ESX installer. This is not much different than any other Red Hat Kickstart. I am going to assume you already have a working PXE booting environment using pxelinux and a FTP server set up to host the install media plus kickstart configurations.

The first thing to do is copy the contents of the install media to a location on your FTP server. If you have the install media in ISO form, it is as easy as this:

mkdir /mnt/esxinstall
mount -o loop /path/to/esx.iso /mnt/esxinstall
cp -r /mnt/esxinstall /var/ftp/pub
umount /mnt/esxinstall
rm -r /mnt/esxinstall

Verify that you can navigate the contents via FTP on another machine before continuing. Now that the media is accessible, we need the kernel and initial ram disk to boot from pxelinux. You will find both in the contents of the install media, in images/pxeboot, with the names vmlinuz and initrd.img. Copy these files somewhere in your tftpboot directory like so:

cd /var/ftp/pub/esxinstall/images/pxeboot
cp vmlinuz initrd.img /var/lib/tftpboot/esx

Note that /var/lib/tftpboot is where tftpboot resides on Fedora 10, the distribution I am hosting everything in this example on. This may be different on your system. The next step is to make your kickstart configuration. The easiest way to get a starting point on this is to install ESX normally. After install, ESX stores a kickstart config based on the install in /root/anaconda-ks.cfg, like every other Red Hat derivative. ESX features some special kickstart options for VMware specific functions, like service console memory and virtual networking. Here is a minimal headless kickstart for ESX:

install
lang en_US.UTF-8
langsupport --default en_US.UTF-8
keyboard us
mouse genericwheelps/2 --device psaux
skipx
vmaccepteula
# DHCP if you are doing multiple
network --device eth0 --bootproto dhcp --addvmportgroup=1 --vlanid=0
rootpw this_is_too_easy
firewall --enabled
authconfig --enableshadow --enablemd5
timezone --utc America/Denver
bootloader --location=mbr
clearpart --exceptvmfs --drives=sda
part /boot --fstype ext3 --size=100 --ondisk=sda --asprimary
part / --fstype ext3 --size=1800 --grow --maxsize=5000 --ondisk=sda
part swap --size=544 --grow --maxsize=544 --ondisk=sda
part /var/log --fstype ext3 --size=500 --grow --maxsize=2000 --ondisk=sda
part local --size 1 --ondisk=sda --fstype vmfs2 --grow

%packages
grub

%post
# Put whatever commands you would like to run at the end here,
# Just like in other Kickstarts

Put your kickstart somewhere available from your FTP, like /var/ftp/pub/esxinstall/headless.cfg. For the final ordeal, we need to add a entry in pxelinux.cfg/default or similar, so our machines can PXE boot. Here is what it might look like:

label esx
  kernel esx/vmlinuz
  append initrd=esx/initrd.img ramdisk_size=7268  ksdevice=eth0 ip=dhcp \
    method=ftp://yourftpserver/esxinstall ks=ftp://yourftpserver/esxinstall/headless.cfg

This will give you headless installs. NOTE: Do not include the backslashes and line breaks in your append line of your pxelinux entry. These are only here for readability's sake. Here is an explanation of the append options.

  • ksdevice If you have multiple nics, you can tell anaconda which to use during the first install phase.
  • ip Tell anaconda how to configure networking for this install.
  • method = URL to your media.
  • ks = URL to your kickstart configuration.
Posted by Tyler Lesmann on March 14, 2009 at 15:59
Tagged as: pxe red_hat vmware
Comments
#1 Deepak wrote this 4 years, 7 months ago

Can we make a PXE boot of ESX 4? It is not an ESXi version and I need an PXE boot of this! Can I do this?

#2 Tyler Lesmann wrote this 4 years, 7 months ago

I'll download the trial and see what I can do. :)

#3 Deepak wrote this 4 years, 7 months ago

Hi,
Could you please send the procedure to me to deepakgkk2003@yahoo.co.in . I require it very urgently.

#4 Abhijit G. wrote this 4 years, 7 months ago

Deepak refer this site for the same.
http://communities.vmware.com/blogs/StephenCampbell/2009/05/25/deploying-vsphere-esx-4-using-pxe

#5 Braga wrote this 4 years, 1 month ago

Does this really perform headless install ?? I tried this approach, does seem to work for me ???

I dont have a VGA device connected to my system at all.

is there any special trick ??? (I am using ESX 4.0)

Post a comment