VMware – Vsphere5 unattended installation step by step with PXE boot

>


Let me brief about the PXE environment I have setup on my home lab. I have installed CentOS 5.x and configuring TFTP, DHCP, APACHE for step by step vsphere5 unattended installation with PXE boot.
1 –  tftp-server installation/configuration  step by step if not already installed.
[root@linux10 xinetd.d]# yum install tftp-server
localrepo                 100% |=========================|  951 B    00:00    
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package tftp-server.i386 0:0.42-3.1.el5.centos set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 tftp-server             i386       0.42-3.1.el5.centos  localrepo          27 k
Transaction Summary
=====================================================Install      1 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
Total download size: 27 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: tftp-server                  ######################### [1/1]
Installed: tftp-server.i386 0:0.42-3.1.el5.centos
Complete!
[root@linux10 xinetd.d]# vi /etc/xinetd.d/tftp
Note – make disable = no inside the tftp file
[root@linux10 xinetd.d]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
2- dhcp installation/configuration step by step if not installed already.
[root@linux10 tftpboot]# yum install dhcp
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package dhcp.i386 12:3.0.5-13.el5 set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 dhcp                    i386       12:3.0.5-13.el5  localrepo         874 k
Transaction Summary
=============================================================================
Install      1 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
Total download size: 874 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: dhcp                         ######################### [1/1]
Installed: dhcp.i386 12:3.0.5-13.el5
Complete!
 [root@linux10 tftpboot]# vi /etc/dhcpd.conf
[root@linux10 tftpboot]#
[root@linux10 tmp]# cat /etc/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample 
###############################################################
# Note – This block is specifix to single host installation with match hardware address -00-0C-29-8D-FD-A0
    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;
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.200 192.168.1.254;
        default-lease-time 3600;
        max-lease-time 4800;
        option routers 192.168.1.1;
        option domain-name-servers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option ntp-servers 192.168.1.1;
}
#and the host block.
host esxi5first {
        hardware ethernet 00:0C:29:8D:FD:A0;
        fixed-address 192.168.1.210;
        option host-name “esxifirst”;
        filename “pxelinux.0”;
        next-server 192.168.1.101;
}
########################################################################
#Note – you want to deploy this over an entire subnet, it’d be a tedious task to create host blocks for every computer. Likewise, the following is perfectly valid. 
#######################################################################
 #   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;
#subnet 192.168.1.0 netmask 255.255.255.0 {
 #       range 192.168.1.200 192.168.1.254;
 #       default-lease-time 3600;
 #       max-lease-time 4800;
 #       option routers 192.168.1.1;
 #       option domain-name-servers 192.168.1.1;
 #       option subnet-mask 255.255.255.0;
 #       option time-offset -7;
 #       option ntp-servers 192.168.1.1;
 #       option netbios-name-servers 192.168.1.1;
  #      filename “pxelinux.0”;
#        next-server 192.168.1.101;
#}
########################################################################
[root@linux10 ~]# /
Note
1 –  In /etc/dhcpd.conf file , please specify correct subnet/netmask/range/next-server IP etc.
2 – next-server IP is the DHCPD IP address where TFTPD is running for pxelinux.o client.
3 – This installation is based on  one box installation that is the reason I have mapped client machine hardware address inside /etc/dhcpd.conf file and specify the client  machine hostname as esxifirst.
However this gives you the opportunity to install whole subnet installation by uncomment the following from /etc/dhcpd.conf
#subnet 192.168.1.0 netmask 255.255.255.0 {
 #       range 192.168.1.200 192.168.1.254;
 #       default-lease-time 3600;
 #       max-lease-time 4800;
 #       option routers 192.168.1.1;
 #       option domain-name-servers 192.168.1.1;
 #       option subnet-mask 255.255.255.0;
 #       option time-offset -7;
 #       option ntp-servers 192.168.1.1;
 #       option netbios-name-servers 192.168.1.1;
  #      filename “pxelinux.0”;
#        next-server 192.168.1.101;
#}
And commenting
subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.200 192.168.1.254;
        default-lease-time 3600;
        max-lease-time 4800;
        option routers 192.168.1.1;
        option domain-name-servers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option ntp-servers 192.168.1.1;
}
#and the host block.
host esxi5first {
        hardware ethernet 00:0C:29:8D:FD:A0;
        fixed-address 192.168.1.210;
        option host-name “esxifirst”;
        filename “pxelinux.0”;
        next-server 192.168.1.101;
}
3 – Mounting the VMware-ESXi ISO image on Linux system in order to copy the entire files/folder on local system.
[root@linux10 ~]# mount -t iso9660 -o loop VMware-VMvisor-Installer-5.0.0-469512.x86_64.iso /mnt/
[root@linux10 ~]# cd /mnt/
4 – Create a folder named esxi5 inside /tftpboot directory and copy the ESXi5 content from /mnt to /tftpboot/esxi5/
[root@linux10 mnt]# mkdir –p  /tftpboot/esxi5/
[root@linux10 mnt]# cp -r * /tftpboot/esxi5/
[root@linux10 mnt]#
5 – Configuring and Copying PXELINUX.O file in order to get PXE boot.
Note – Please make sure syslinux version should be or greater than 3.86.x .
You can download it from here –
[root@linux10 xinetd.d]#cd /tmp
[root@linux10 xinetd.d]# gunzip syslinux-3.86.tar.gz
[root@linux10 xinetd.d]#tar xvf syslinux-3.86.tar
[root@linux10 xinetd.d]#cp /tmp/syslinux-3.86/core/pxelinux.0 /tftpboot/
[root@linux10 xinetd.d]# cd /tftpboot/
Note – Create pxelinux.cfg directory inside to /tftpboot to hold a boot file for vsphere5 installation along with kickstart location.
[root@linux10 tftpboot]# mkdir pxelinux.cfg
 [root@linux10 tftpboot]# ls
esxi5  pxelinux.0  pxelinux.cfg
[root@linux10 tftpboot]#
pxelinux is the utility that enables the PXE functionality. As mentioned before, pxelinux.0 is an executable that the server downloads. The executable provides functionality to parse a menu system, load kernels, options, customizations, modules, etc, and boot the server. Since PXE can be used by multiple physical servers for multiple images, we need to configure pxelinux for this specific image.
pxelinux.0 looks for configuration files in the TFTP:/pxelinux.cfg directory.
pxelinux looks for a large number of configuration files… specific to a default/generic value. This allows server administrators to define a file based on a complete MAC address, partial MAC address, or none at all to determine which image to boot from.
The installation media contains a file called isolinux.cfg. We can use this as the basis for our file called ‘default. Copy it from the installation media and start customizations:
[root@linux10 tftpboot]# cd pxelinux.cfg/
[root@linux10 pxelinux.cfg]# cp /tftpboot/esxi5/isolinux.cfg default
Notedefault is just a name .
Note – Edit the contents of default file as per requirement
[root@linux10 pxelinux.cfg]# cat default
prompt 1
timeout 10
label ESXi 5 install scripted
default /esxi5/menu.c32
menu label ^ESXi5-01 Scripted install
kernel /esxi5/mboot.c32
append -c /esxi5/boot.cfg ks=http://192.168.1.101/ks/esxi5.txt
[root@linux10 pxelinux.cfg]#
6 – Preparing Kickstart file –
Kick start address –   http://192.168.1.101/ks/esxi5.cfg
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI and Tech Support Mode
rootpw password
# Install on the first local disk available on machine
install –firstdisk –overwritevmfs
# Set the network to DHCP on the first network adapater, use the specified hostname and donot create a portgroup for the VMs
network –bootproto=dhcp –device=vmnic0
Note – You can prepare as per your standard.
7 – Configure the installation files
The CD/ISO installation media for ESXi 5.0 assumes a single installation point. Thus, all the files are placed at the root of the image. However, since we want to actually organize our installation root, we added the ‘/tftpboot/esxi5/ ‘ directory and copied the files into it. We need to adjust the installation files in /tftpboot/esxi5/ to reflect the change.
   [root@linux10 esxi5]#  cd /tftpboot/esxi5
   [root@linux10 esxi5]#  cp  boot.cfg boot.cfg.orig
  [root@linux10 esxi5]#  vi boot.cfg
Note – Add the prefix=/esxi5/ inside boot.cfg file  and remove all of the slashes (/) from the boot.cfg file so relative paths can be use
For example – it should be like useropts.gz not /useropts.gz ( by default this takes path as a /useropts.gz)
[root@linux10 esxi5]# cat boot.cfg
bootstate=0
title=Loading ESXi installer
prefix=/esxi5/
kernel=tboot.b00
#kernelopt=runweasel
modules=b.b00 — 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
[root@linux10 esxi5]#
NoteI have commented kernelopts in boot.cfg
Note
 Boot the client machine, have a cup of coffee, installation will take place automatically.
Advertisements

6 thoughts on “VMware – Vsphere5 unattended installation step by step with PXE boot

  1. Jalen November 17, 2011 at 6:46 pm Reply

    I was so confused about what to buy, but this makes it udnerstandalbe.

    • Cayden December 1, 2011 at 2:29 pm Reply

      Felt so hopeless lokoing for answers to my questions…until now.

    • Lyndall December 3, 2011 at 8:02 am Reply

      Your story was really inofrtmaive, thanks!

  2. postal rates November 18, 2011 at 11:31 pm Reply

    i love your blog, i have it in my rss reader and always like new things coming up from it.

    • Voncile December 1, 2011 at 9:11 am Reply

      I literally jumped out of my chair and dnaced after reading this!

    • Charlotte December 3, 2011 at 5:41 am Reply

      Nohntig I could say would give you undue credit for this story.

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: