ESXi 5.0 PXE Install


ESXi PXE install has no differences from other PXE installs, you need DHCP server, tftp server and the installation ISO.

In my example, I build the DHCP server and tftp server on CentOS 6.3 minimal installation.

1) Install and configure the DHCP Server

yum –y install dhcp

cd /etc/dhcp/

cp –a dhcpd.conf dhcpd.conf.bak

Modify dhcpd.conf configuration file

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see ‘man 5 dhcpd.conf’
#

ddns-update-style ad-hoc;
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 192.168.5.123; # Your server IP
filename “pxelinux.0”;
}
#dhcp ip range
subnet 192.168.5.0 netmask 255.255.255.0 {
range 192.168.5.231 192.168.5.233;
}

Start the DHCP service

service dhcpd start

2) Install and configure the tftp server

yum –y install tftp*

Modify the tftp configuration file /etc/xinetd.d/tftp

service tftp
{
        disable = no
        bind                    = 192.168.5.123
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

Start the TFTP service

service xinetd start

3) Download pxelinux.0 file and place it into the tftpboot folder.

cd /tmp

wget http://www.kernel.org/pub/linux/utils/boot/syslinux/3.xx/syslinux-3.86.tar.gz

tar xvzf syslinux-3.86.tar.gz

cp /tmp/syslinux-3.86/core/pxelinux.0 /var/lib/tftpboot/

4) Copy the ESXi 5.0 installation file to tftp folder

mount -t iso9660 -o loop VMware-VMvisor-Installer-5.0.0-469512.x86_64.iso /media/

mkdir /var/lib/tftpboot/esxi50/

cp -a /media/* /var/lib/tftpboot/esxi50/

umount /media

cd /var/lib/tftpboot

mkdir pxelinux.cfg

cd pxelinux.cfg/

cp -a ../esxi50/isolinux.cfg default

chmod 755 default

Modify the default file

DEFAULT /esxi50/menu.c32
MENU TITLE ESXi-5.0.0-20120302001-standard Boot Menu
NOHALT 1
PROMPT 0
TIMEOUT 80
LABEL install
  KERNEL /esxi50/mboot.c32
  APPEND -c
/esxi50/boot.cfg
  MENU LABEL ESXi-5.0.0-20120302001-standard ^Installer
LABEL hddboot
  LOCALBOOT 0x80
  MENU LABEL ^Boot from local disk

5) Modify the boot.cfg file in esxi50 folder

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

6) Place the kick start file to your Apache server

mkdir /var/www/html/ks

Create a new file named ks.cfg. Here is a sample:

# Accept the VMware End User License Agreement
vmaccepteula

# Set the root password for the DCUI and ESXi Shell
rootpw mypassword

# Install on the first local disk available on machine
install –firstdisk –overwritevmfs

# reboots the host after the scripted installation is completed
reboot

%firstboot –interpreter=busybox

# Set DNS and hostname
esxcli system hostname set –fqdn=ESXi-01.sandbox.local
esxcli network ip dns search add –domain=sandbox.local
esxcli network ip dns server add –server=192.168.5.1
esxcli network ip dns server add –server=192.168.5.2

# Set syslog server and open syslog firewall ports
esxcli system syslog config set –loghost=’tcp://ntp.sandbox.local:514′ –logdir=’/vmfs/volumes/3f7ac950-84fed078-4c5d-5cf3fcad2d4a/Logs’
esxcli network firewall ruleset set –ruleset-id=syslog –enabled=true
esxcli network firewall refresh
esxcli system syslog reload

# Set satp default path policy to round robin
esxcli storage nmp satp set -s VMW_SATP_SVC -P VMW_PSP_RR

# Reserver all RDM datastores to speed the boot time if have any
# esxcli storage core device setconfig -d naa.XXXXXXXXXXXXXXXXXXXXXXXXX  –perennially-reserved=true

# Setup vSwitch0
esxcli network vswitch standard add -v vSwitch0
esxcli network vswitch standard uplink add -v vSwitch0 -u vmnic0  
esxcli network vswitch standard uplink add -v vSwitch0 -u vmnic1
esxcli network vswitch standard policy failover set -v vSwitch0 -n true -f beacon -l portid -b false -a vmnic0,vmnic1
esxcli network vswitch standard policy security set -v vSwitch0 -p false -m false -f false
esxcli network vswitch standard policy shaping set -v vSwitch0 -e false
esxcli network vswitch standard portgroup add -v vSwitch0 -p ‘Management Network’
esxcli network vswitch standard portgroup set -p ‘Management Network’ -v 5
esxcli network ip interface add -i vmk0 -p ‘Management Network’
esxcli network ip interface ipv4 set -i vmk0 -I 192.168.5.11 -N 255.255.255.0 -t static
esxcli network ip interface set -i vmk0 -e true

# Setup vSwitch1
esxcli network vswitch standard add -v vSwitch1
esxcli network vswitch standard uplink add -v vSwitch1 -u vmnic3  
esxcli network vswitch standard uplink add -v vSwitch1 -u vmnic2
esxcli network vswitch standard policy failover set -v vSwitch1 -n true -f beacon -l portid -b false -a vmnic2,vmnic3
esxcli network vswitch standard policy security set -v vSwitch1 -p false -m false -f false
esxcli network vswitch standard policy shaping set -v vSwitch1 -e false
esxcli network vswitch standard portgroup add -v vSwitch1 -p DEV
esxcli network vswitch standard portgroup add -v vSwitch1 -p PRO
esxcli network vswitch standard portgroup add -v vSwitch1 -p ‘Management Network1’
esxcli network vswitch standard portgroup set -p DEV -v 6
esxcli network vswitch standard portgroup set -p PRO -v 7
esxcli network vswitch standard portgroup set -p ‘vMotion’ -v 8
esxcli network ip interface add -i vmk1 -p ‘vMotion’
esxcli network ip interface ipv4 set -i vmk1 -I 192.168.8.11 -N 255.255.255.0 -t static
esxcli network ip interface set -i vmk1 -e true
vim-cmd hostsvc/vmotion/vnic_set vmk1

# Backup ESXi configuration to persist changes
/sbin/auto-backup.sh
 
# Enter maintenance mode
#vim-cmd hostsvc/maintenance_mode_enter

7) Add the virtual directory to Apache settings

vi /etc/httpd/conf/httpd.conf

Alias /ks/ “/var/www/html/ks/”
  <Directory “/var/www/html/ks”>
    Order allow,deny
    Allow from all
  </Directory>

Restart the Apache service

service httpd restart

8) Boot the target host and choose PXE network install.

 

References:

http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vsphere.install.doc_50%2FGUID-91E32FD0-A33C-4302-9FAB-B52B8A5CEFBC.html

http://gestaltit.com/featured/top/bill/vsphere-5pxe-installation-vcenter-virtual-appliance/ 

http://www.virtuallyghetto.com/2011/07/automating-esxi-5x-kickstart-tips.html

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s