Creating a PXE boot for ESXi 4.1 with a kickstart installation

For the VMware course I teach for Ictivity Training VMware ESXi server have to be deployed on a regular basis. In the passed I have made a kickstart installation for ESX witch could be used on a USB stick during the boot of the DVD. Now that we’re upgrading the VMware courses to vSphere ESXi 4.1 I wanted to create a PXE boot environment witch could be used to install different ESXi 4.1 servers.
Because I’m a Novell/VMware guy I wanted to create a SLES11 virtual machine for the PXE boot environment that runs on VMware vSphere or VMware Workstation.

I’m assuming that you all know how to create a virtual machine and how to install SLES 11 inside this virtual machine with the VMware tools.
During installation make sure you select the following packages:

  • DHCP Server
  • TFTP Server
  • Apache
  • syslinux

I’m also assuming you have downloaded the VMware ESXi 4.1 iso file from the VMware website and that this is located in the /root directory.

For testing purpose, we’re not going to enable the kickstart installation during the test of PXE boot. This is added later.

PXE Setup

First step is to configure the DHCP server. Here is my configuration file.

option domain-name “training.local”;
option domain-name-servers;
option routers;
default-lease-time 14400;
ddns-update-style none;
authoritative ;
filename “pxelinux.0”;
subnet netmask {
default-lease-time 14400;
max-lease-time 172800;

This configuration file gives a lease in the range – with a subnetmask of, a default gateway and a domain name server The option filename “pxelinux.0” will tell the PXE client to look on this server with the tftp protocol for a fill called pxelinux.0. We’re going to provide this file later on.
Make sure that the DHCP server is started at boot time.

Second step is to configure the TFTP server.
In yast under Network Services select TFTP server. Yast will tell you that the default location for the TFTP files will be /tftpboot. In my case I move this location to /srv/tftp because I think this is a better location. Make sure that the TFTP server is started at boot time.

Third step is to provide the necessary file for the PXE boot.

  • Copy the /usr/share/syslinux/pxelinux.0 to /srv/tftp
  • Create a directory /srv/tftp/pxelinux.cfg
  • In this directory create a file called default and open this file in your default text editor. Below is my file.
  • MENU TITLE Ictivity Training VMware ESXi installation menu
    PROMPT 1 #display the boot: option during boot
    TIMEOUT 100 # a timeout value of 10 second after this de DEFAULT will be started unless another option is entered during boot
    DEFAULT localboot #default is the option localboot

    SAY Welcom to the Ictivity Training VMware ESXi installation menu #Some text messages
    SAY Type esxinstall to start the VMware ESXi installation, do nothing local boot will happen. #Some text messages

    LABEL localboot
    localboot 0x80

    LABEL esxinstall
    kernel vmware/esxi4.1/mboot.c32
    append vmware/esxi4.1/vmkboot.gz — vmware/esxi4.1/vmkernel.gz — vmware/esxi4.1/sys.vgz — vmware/esxi4.1/cim.vgz — vmware/esxi4.1/ienviron.vgz — vmware/esxi4.1/install.vgz — vmware/esxi4.1/image.tgz

  • This file is read during the PXE boot. We will provide the files in vmware/esxi4.1/* in a later step.

Foured step is to provide the ESXi file for installation.

  • Mount the iso file that you have save in the /root directory with the command:

    mount -o loop /root/VMware-VMvisor-Installer-4.1.0-260247.x86_64.iso /mnt/iso

    This assumes that you have a directory called /mnt/iso!

  • Create a directory /srv/tftp/vmware/esxi4.1/
  • Give the command:
    cp -R /mnt/iso /srv/tftp/vmware/esxi4.1/

Now we’re ready to test the PXE boot.


Now PXE booting is working we can create a kickstart script file (normally called ks.cfg). This file will be located in the default documentroot of Apache (/srv/www/htdocs).

  • Create a file called ks.cfg, place this file in /srv/www/htdocs and open this file with you favorite text editor.
  • Below is my ks.cfg file. This is not a complex file but for my purpose (setting-up the classroom environment) this does the trick.

    #Kickstart script file for host vsphere1
    #Created by: M. Wilmsen/WilmsenIT
    #Date: 8/12/2010

    rootpw yourpassword
    autopart –firstdisk –overwritevmfs
    install url
    network –bootproto=static –ip= –gateway= –nameserver= –netmask= – –addvmportgroup=0

  • In the documentroot of Apache the installation files of ESXi 4.1 have to be available. The file will be place in the directory vmware. Ofcourse you can copy the files from the iso file again to the vmware directory. But we did this already for the PXE setup. So rather than copying the files again we make a symbolic link to /srv/tftp/vmware/esxi4.1/

    ln -s /srv/ftfp/vmware/esxi4.1/ vmware

  • Because we’re using a symbolic link and that the ks.cfg file is located on the documentroot of Apache we have to enable the options Indexes and FollowSymLinks in the /etc/apache2/default-server.conf file.

    <Directory “/srv/www/htdocs”>
    # Possible values for the Options directive are “None”, “All”,
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    # Note that “MultiViews” must be named *explicitly* — “Options All”
    # doesn’t give it to you.
    # The Options directive is both complicated and important.  Please see
    # for more information.
    Options Indexes FollowSymLinks
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be “All”, “None”, or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    AllowOverride None
    # Controls who can get stuff from this server.
    Order allow,deny
    Allow from all

  • The final step is to modify the default PXE configuration file in order to tell the ESXi setup to make use of our ks.cfg file. To do this open the /srv/tftp/pxelinux.cfg/default in you favorite text editor and add ks= after the vmkboot.gz option. Your default file will look like this:

    menu title Ictivity Training VMware ESXi installation menu
    PROMPT 1
    TIMEOUT 100
    DEFAULT localboot

    SAY Welcom to the Ictivity Training VMware ESXi installation menu
    SAY Type the servername to start the VMware ESXi installation, do nothing local boot will happen.
    SAY Valid servernames are: vsphere1

    LABEL localboot
    localboot 0x80

    LABEL vsphere1
    kernel vmware/esxi4.1/mboot.c32
    append vmware/esxi4.1/vmkboot.gz ks= — vmware/esxi4.1/vmkernel.gz — vmware/esxi4.1/sys.vgz4.1/image.tgz

And there you go. Now we can use PXE boot to install our ESXi 4.1 servers. Of course you can create a more advanced ks.cfg file but that’s up to you.

About Michael
Michael Wilmsen is a experienced VMware Architect with more than 20 years in the IT industry. Main focus is VMware vSphere, Horizon View and Hyper Converged with a deep interest into performance and architecture. Michael is VCDX 210 certified, has been rewarded with the vExpert title from 2011, Nutanix Tech Champion and a Nutanix Platform Professional.

RSS feed for comments on this post.

Leave a Reply

You must be logged in to post a comment.