Create a VMware ESXi 5 PXE unattended scripted installation using Windows

The most information available on how-to perform a unattended scripted installation of VMware ESXi 5 is based on Linux. Here is a procedure how-to create a scripted installation of VMware ESXi 5 using Microsoft Windows.

Here is an overview of the boot process:

 

image

 

 

What do we need

The following software must be downloaded:

Syslinux 3.86 (This is the Syslinux version VMware supports)

FileZilla Server 0_9_39

TFTPD 4.00

Notepad ++

VMware ESXi 5 ISO

 

Step 1 Windows XP

This procedure is tested with Microsoft Windows XP SP2. The following requirements must be met:

– In Windows XP use a fixed IP. In this example we use 192.168.1.1/24 IP address

– Make sure there is enough free disk space available (approximately 500 MB needed)

– Disable the Windows firewall

Step 2 Create directory structure

Create the following directory structure in the root of the C: partition:

C:\PXEboot
C:\PXEboot\pxelinux.cfg
C:\PXEboot\kickstart

Step 3 Copy the content of the ESXi 5 ISO

Mount the VMware ESXi 5 ISO and copy the content to the c:\PXEboot directory

Step 4 Copy the Syslinux files

The Syslinux files allow the target ESXi server to boot the ESXi installer.

– Extract Syslinux 3.86 and:

– Copy the pxelinux.0 and menu.c32 files to the C:\PXEboot directory.

– Overwrite the menu.c32 file

 

Step 5 Install & Configure tftpd32

The Tftpd32 utility gets the function DHCP and TFTP server.

– Run Tftpd32.exe and make the following configuration settings:

 

image image
Choose:
– TFTP Server
– DHCP Server
Point the base directory to c:\PXEboot
image image
Create a DHCP range Edit the ini file c:\program files\tftpd32\tftpd32.iniAdd the DHCP options
066 with DHCP server IP address
067 pxelinux.0

 

– Restart and run the tftpd32.exe utility

 

Step 6 Install  & configure FileZilla server

– Install the FileZilla Server with the default settings

– Create a user username: vmware password: vmware

image

– Add a shared folder c:\PXEboot\Kickstart folder with the default rights

2011-09-19 18h32_16

 

Step 7 Create default file

Create a file named default (Use notepad ++ for the file creation) and save the file in the  C:\PXEboot\pxelinux.cfg directory. Here is an example default script:

 

DEFAULT menu.c32
MENU TITLE ESXi 5 Boot menu
NOHALT 1
PROMPT 0
TIMEOUT 80

LABEL install 
 KERNEL mboot.c32 
 APPEND -c boot.cfg 
 MENU LABEL ^ESXi-5 Interactively install

Label ESXi 5 install scripted 
 KERNEL mboot.c32 
 APPEND -c boot.cfg ks=ftp://vmware:vmware@192.168.1.1/ks.cfg +++ 
 MENU LABEL ^ESXi5-01 Scripted install 
 IPAPPEND 1

LABEL hddboot 
 LOCALBOOT 0x80 
 MENU LABEL ^Boot from local disk

If you want to install more VMware ESXi 5 servers you can add extra entries in the default file and point them to separate Kickstart file.


Step 8 Create ks.cfg file

Create a Kickstart file named ks.cfg (Use notepad ++ for the file creation ) and place the file in the c:\PXEboot\Kickstart directory. Here is a sample ks.cfg script:

#Sample kickstart scripted installation
vmaccepteula
rootpw VMw@re
install --firstdisk --overwritevmfs
network --bootproto=static --ip=192.168.250.21 --gateway=192.168.250.1 --nameserver=192.168.250.6 --netmask=255.255.255.0 --hostname=esxi5-01.beerens.local --device=vmnic0 --addvmportgroup=0
reboot

%firstboot --interpreter=busybox
# Rename local datastore name
vim-cmd hostsvc/datastore/rename datastore1 "$(hostname -s)-local-storage-1"
# DNS names
esxcli system hostname set --fqdn=esxi5-01.beerens.local
esxcli network ip dns search add --domain=beerens.local
# DNS server addresses
esxcli network ip dns server add --server=192.168.250.6
esxcli network ip dns server add --server=192.168.250.1
# SSH and ESXi shell
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell

 

Step 9 Test the installation

Boot the server and select ESXi5-01 Scripted Install option to test the scripted installation.

 

image

 

[ad#banner]

Create a bootable VMware ESXi 5 USB stick in Windows and perform a scripted installation

Here is a simple procedure to make a bootable VMware ESXi 5 or ESXi 6 USB stick in Windows and perform a scripted unattended VMware ESXi installation. The 5 steps are:

Step 1

Be sure removing all partitions and format a FAT32 partition on the USB stick by using the following command:

Open the command prompt and enter the following commands:

diskpart (make sure you run diskpart as administrator) 
list disk (list the disk in your system including the USB) 
select disk USB number 
clean 
create partition primary 
active 
format fs=fat32 quick
assign
exit

Step 2

Download the Windows LinuxLive USB creator utility here.

Step 3

Start the Lili USB creator utility.

 

image

Follow the steps 1,2,4 and click 5 to create the USB stick. Wait till the USB creation process is finished. So now you have a bootable ESXi stick. You can stop here if you you want to install ESXi with manual installation steps.   

Step 4

Edit the BOOT.CFG file in the root of the USB stick and add ks=usb between /b.b00 and — /useropts.gz modules

The BOOT.CFG should look like this:

bootstate=0 
title=Loading ESXi installer 
kernel=/tboot.b00 
kernelopt=runweasel 
modules=/b.b00 ks=usb --- /useropts.gz --- /k.b00 --- /a.b00 --- /ata-pata.v00 --- /ata-pata.v01 --- /ata-pata.v02 --- /ata-pata.v03 --- /ata-pata.v04 --- /ata-pata.v05 --- /ata-pata.v06 --- /ata-pata.v07 --- /block-cc.v00 --- /ehci-ehc.v00 --- /s.v00 --- /weaselin.i00 --- /ima-qla4.v00 --- /ipmi-ipm.v00 --- /ipmi-ipm.v01 --- /ipmi-ipm.v02 --- /misc-cni.v00 --- /misc-dri.v00 --- /net-be2n.v00 --- /net-bnx2.v00 --- /net-bnx2.v01 --- /net-cnic.v00 --- /net-e100.v00 --- /net-e100.v01 --- /net-enic.v00 --- /net-forc.v00 --- /net-igb.v00 --- /net-ixgb.v00 --- /net-nx-n.v00 --- /net-r816.v00 --- /net-r816.v01 --- /net-s2io.v00 --- /net-sky2.v00 --- /net-tg3.v00 --- /ohci-usb.v00 --- /sata-ahc.v00 --- /sata-ata.v00 --- /sata-sat.v00 --- /sata-sat.v01 --- /sata-sat.v02 --- /sata-sat.v03 --- /scsi-aac.v00 --- /scsi-adp.v00 --- /scsi-aic.v00 --- /scsi-bnx.v00 --- /scsi-fni.v00 --- /scsi-hps.v00 --- /scsi-ips.v00 --- /scsi-lpf.v00 --- /scsi-meg.v00 --- /scsi-meg.v01 --- /scsi-meg.v02 --- /scsi-mpt.v00 --- /scsi-mpt.v01 --- /scsi-mpt.v02 --- /scsi-qla.v00 --- /scsi-qla.v01 --- /uhci-usb.v00 --- /tools.t00 --- /imgdb.tgz --- /imgpayld.tgz 
build= 
updated=0

 

Step 5

Create a Kickstart configuration file for the scripted installation in the root of the USB stick. Here is an example:

#Sample kickstart scripted installation
vmaccepteula
rootpw VMw@re
install --firstdisk --overwritevmfs
network --bootproto=static --ip=192.168.250.21 --gateway=192.168.250.1 --nameserver=192.168.250.6 --netmask=255.255.255.0 --hostname=esxi5-01.beerens.local --device=vmnic0 --addvmportgroup=0
reboot

%firstboot --interpreter=busybox
# Rename local datastore name
vim-cmd hostsvc/datastore/rename datastore1 "$(hostname -s)-local-storage-1"
# DNS names
esxcli system hostname set --fqdn=esxi5-01.beerens.local
esxcli network ip dns search add --domain=beerens.local
# DNS server addresses
esxcli network ip dns server add --server=192.168.250.6
esxcli network ip dns server add --server=192.168.250.1
# SSH and ESXi shell
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell

For editing and creating the boot.cfg and ks.cfg file in Windows I use Notepad++ so NO hidden carriage returns are in the files. And the USB stick creation in ready.

An easy way to test the ESXi 5 USB stick and the scripted installation  is using VMware Workstation. See my post “Boot from USB in VMware Workstation” found here.

 

William Lam’s blog has real good information about Kickstart scripts found here.