android (3)
ant (2)
beautifulsoup (1)
debian (1)
decorators (1)
django (9)
dovecot (1)
encryption (1)
fix (4)
gotcha (2)
hobo (1)
htmlparser (1)
imaplib (2)
java (1)
json (2)
kerberos (2)
linux (7)
lxml (5)
markdown (4)
mechanize (6)
multiprocessing (1)
mysql (2)
nagios (2)
new_features (3)
open_source (5)
optparse (2)
parsing (1)
perl (2)
postgres (1)
preseed (1)
pxe (4)
pyqt4 (1)
python (41)
raid (1)
rails (1)
red_hat (1)
reportlab (4)
request_tracker (2)
rt (2)
ruby (1)
scala (1)
screen_scraping (7)
shell_scripting (8)
soap (1)
solaris (3)
sql (2)
sqlalchemy (2)
tips_and_tricks (1)
twitter (2)
ubuntu (1)
vmware (2)
windows (1)
zimbra (2)

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:

lang en_US.UTF-8
langsupport --default en_US.UTF-8
keyboard us
mouse genericwheelps/2 --device psaux
# 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


# 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 and commented on 5 times
Tagged as: pxe red_hat vmware