Книга: Mastering VMware® Infrastructure3

Unattended ESX Server Installation

Unattended ESX Server Installation

Installing an ESX Server 3.5 host in an unattended fashion can be done using third-party imaging tools or using the native VMware tools. Using the native tools requires several network-accessible components, including:

? An existing ESX Server 3.5 installation

? An NFS server accessible by the host to be installed

? A copy of the ESX Server 3.5 installation media

? An installation script with the appropriate configuration parameters


Figure 2.19 ESX Server 3.5 uses the GRUB boot loader.


Figure 2.20 After a reboot, the console offers the data necessary for accessing the server from a remote computer.

Figure 2.21 details the infrastructure components needed to complete an unattended ESX Server 3.5 installation using the tools built into ESX Server 3.5.

The unattended installation procedure involves booting the computer and reading the installation files, and reading the unattended installation script. The destination host can be booted from CD, floppy, or PXE boot and then directed to the location of the installation files and answer files. The installation files and/or answer script can be stored and accessed from any of the following locations:

? An HTTP URL

? A shared NFS directory

? An FTP directory

? A CD (install files only)

? A floppy disk (answer files only)

Table 2.4 outlines the various methods and the boot options required for each option set. The boot option is typed at the boot prompt on ESX Server 3.5 graphical versus text mode selection screen.


Figure 2.21 Performing an unattended ESX Server 3.5 installation requires the proper network servers and services.

Table 2.4: Unattended Installation Methods

If the computer boots from And the media is stored on a And the answer file is stored on a Then the boot option is
PXE (Media) URL (Answer) URL esx ks=<answer URL> method=<media URL> ksdevice=<NIC>
CD CD URL esx ks=<answer URL> ksdevice=<NIC>
CD CD Floppy esx ks=<floppy drive>
Floppy URL Floppy esx ks=<floppy drive>

The kickstart answer file is created from a web-based wizard accessible from the default home page of an ESX Server host, as shown in Figure 2.22.

By default, an ESX Server 3.5 host is not configured to allow access to the scripted installer. An error, shown in Figure 2.23, identifies clearly that a given host has not been configured.


Figure 2.22 The home page for an ESX Server host provides access to the Scripted Installer, which generates an answer file through a web-based wizard. 


Figure 2.23 Access to the scripted installer must be enabled on an ESX Server 3.5 host.

Perform the following steps to enable the Scripted Installer on an ESX Server 3.5 host and to create a kickstart file:

1. Establish a console session with an ESX Server 3.5 host.

2. Type the following command:

cd /usr/lib/vmware/webAccess/tomcat/apache-tomcat-5.5.17/webapps/ui/WEB-INF

3. Type the following command to get a list of all files and folders in the current directory:

ls

4. Type the following command:

nano -w struts-config.xml

5. Comment out the following line by adding <!-- to the front of the line and --> to the end of the line, as shown here and in Figure 2.24:

<!-- action path = "/scriptedInstall" type="org.apache.struts.actions.
ForwardAction" parameter="/WEB-INF/jsp/scriptedInstall/disabled.jsp" -->


Figure 2.24 Enabling the Scripted Installer requires minor editing of the struts-config.xml file.

6. Uncomment the following lines by removing the <!-- and --> that precede and conclude the series of lines, as shown here and in Figure 2.24:

<action path="scriptedInstall" type="com.vmware.webcenter.scripted.ProcessAction">
 <forward name="scriptedInstall.form1" path="/Web-INF/jsp/scriptedInstall/form1.jsp" />
 <forward name="scriptedInstall.form2" path="/Web-INF/jsp/scriptedInstall/form2.jsp" />
 <forward name="scriptedInstall.form3" path="/Web-INF/jsp/scriptedInstall/form3.jsp" />
 <forward name="scriptedInstall.form4" path="/Web-INF/jsp/scriptedInstall/form4.jsp" />
 <forward name="scriptedInstall.form5" path="/Web-INF/jsp/scriptedInstall/form5.jsp" />
 <forward name="scriptedInstall.form6" path="/Web-INF/jsp/scriptedInstall/form6.jsp" />
 <forward name="scriptedInstall.form7" path="/Web-INF/jsp/scriptedInstall/form7.jsp" />
</action>

7. Type the following command:

service vmware-webAccess restart

8. Return to the ESX Server 3.5 home page and click the link labeled Log In to the Scripted Installer.

9. The Scripted Install web-based wizard will begin. Select the appropriate options for the unattended installation, as shown in Figure 2.25, and then click the Next button. The options include:

? Installation Type: Initial Installation | Upgrade

? Installation Method: CD-ROM | Remote | NFS

 ? This selection identifies where the installation files are located.

? Remote Server URL:<URL of remote server when installation method is set to Remote>

? Network Method: DHCP | Static IP

 ? Static will be the more common selection.

? Create a default network for VMs: Yes | No

 ? This option is negligible. If Yes is selected, the VM network can be deleted later. If No is selected, the VM network can be created later.

? VLAN:<VLAN ID if Service Console should be on a VLAN>

 ? Provide a VLAN ID for Service Console only if you know that a VLAN is configured on the physical switch to which the network adapter is connected.

? Time Zone

? Reboot After Installation: Yes | No

? Root password


Figure 2.25 The Scripted Installer wizard defines the installation type and method as well as the Service Console configuration information.

10. As shown in Figure 2.26, set the hostname and IP address information of the server to be installed with the answer file and then click the Next button.

11. Select the check box labeled I Have Read and Accept the Terms of the License Agreement and then click the Next button.

12. As shown in Figure 2.27, configure the disk partitioning strategy and licensing mode for the target server and then click the Next button. Apply any necessary customizations to the partitions. Licensing options include: Post Install | Use License Server | Use Host License File.

13. Configure the licensing options, as shown in Figure 2.28, and then click the Next button.


Figure 2.26 The Scripted Installer defines the hostname and IP address configuration for the target ESX Server. 


Figure 2.27 The Scripted Installer allows disk partitioning customizations and licensing mode.

14. Click the Download Kickstart File from the final page of the Scripted Installer, as shown in Figure 2.29.

Since a Windows file share is not an option for the location of a kickstart file, the file must be copied to an appropriate location, which is most commonly an NFS directory. Use WordPad to review the kickstart file created by the Scripted Installer wizard. A sample default file is shown in Figure 2.30.


Figure 2.28 The Scripted Installer automates the configuration of pointing an ESX Server to a license server.


Figure 2.29 The finished kickstart file can be saved to the local computer accessing the Scripted Installer web-based wizard.

Using free tools like Veeam FastSCP (http://www.veeam.com) or WinSCP (http://www.winscp.com), the kickstart file can be copied to an NFS directory that is accessible to the target ESX Server. Once the file is in place on the NFS directory, the unattended installation can be launched from the target server.

Perform the following steps to perform an unattended installation using a CD for the installation files and a remote NFS directory for the kickstart file:

1. Boot the target computer from the ESX Server 3.5 CD.

2. At the installation mode selection screen, type the following command, as shown in Figure 2.31:

esx ks=nfs:<IP address or name of NFS server>:<path to kickstart file> ksdevice=<NIC to use>

3. The installation will begin and continue until the final reboot.

Kickstart files can be edited directly through WordPad so that the wizard does not have to be executed for each new installation. Unfortunately, the kickstart file does not provide a way of generating unique information for each installation and therefore each install will require a manually created (or adjusted) kickstart file that is specific to that installation — particularly configuration of static information that must be unique like IP address and hostname.


Figure 2.30 A sample kickstart file created by the Scripted Installer wizard, viewed through WordPad 


Figure 2.31 Using a local installation media with a kickstart file on an NFS directory

Kickstart Customizations

You may have noticed the kickstart file creation wizard did not allow for configuration of Service Console NIC or any virtual networking or storage configuration. That's because by default it doesn't. The lack of Service Console NIC configuration can cause access problems because the kickstart installation automatically selects the NIC with the lowest PCI address. If your Service Console is not to be associated with the NIC that has the lowest PCI address, a postinstallation configuration will be required to unlink the current NIC and link the correct NIC. We will cover how to do this in the next section of this chapter.

Kickstart files can be edited to configure postinstallation configuration. These configurations can include Service Console NIC corrections, creation of virtual switches and port groups, storage configuration, and even customizations of Service Console config files for setting up external time servers.

The command-line syntax for virtual networking and storage will be covered in Chapters 3 and 4. The following kickstart file makes many postinstallation changes:

# Advanced Kickstart file with postinstallation configuration.
# Installation Method
cdrom
# root Password
rootpw --iscrypted a6fh$/hkQQrCaeuc0mAe38$.captvmyeT4
# Authconfig
auth --enableshadow --enablemd5
# BootLoader (Grub has to be the default boot loader for ESX Server 3)
bootloader --driveorder=sda --location=mbr
# Timezone (set this time zone to fit your company policy)
timezone --utc UTC
# Do not install the X windowing System
skipx
# Clean Installation or upgrade an existing installation
install
# Text Mode
text
# Network install type (this server will have a static IP address of 172.30.0.105
with a subnet mask of 2555.255.255.0, a gateway of 172.30.0.1, a DNS server
# of 172.30.0.2 and a hostname of silo3505.vdc.local. It will not be configured on a vlan network --bootproto static --ip 172.30.0.105 --netmask 255.255.255.0 --gateway 172.30.0.1 --nameserver 172.30.0.2 --hostname silo3505.vdc.local --vlanid=0
# Language
lang en_US
# Language Support
langsupport --default en_US
# Keyboard
keyboard us
# Mouse
mouse none
# Force a reboot after the install
reboot
# Firewall settings
firewall --disabled
# Clear all Partitions on the local disk sda
clearpart --all --initlabel --drives=sda
# Partitioning strategy for ESX Server host
part /boot --fstype ext3 --size 200 --ondisk sda
part / --fstype ext3 --size 25000 --ondisk sda
part swap --size 1600 --ondisk sda
part None --fstype vmfs3 --size 1 --grow --ondisk sda part None --fstype vmkcore --size 100 --ondisk sda
part /var --fstype ext3 --size 12000 --ondisk sda part /tmp --fstype ext3 --size 2000 --ondisk sda
# VMware Specific Commands for accepting the license agreement, configuring a
license server at 172.30.0.2 on port 270000, and a full license
vmaccepteula
vmlicense --mode=server [email protected] --edition=esxFull
%packages
@base
@ everything
%post
# Create a new file named S11PostInstallConfig that will become an executable
that is run during the first reboot of the ESX Server
cat > /etc/rc.d/rc3.d/S11PostInstallConfig << EOF #!/bin/bash
# Overwrite the resolv.conf file to create primary and secondary DNS entries
cat > /etc/resolv.conf << DNS
nameserver 172.30.0.2 nameserver 172.30.0.3 DNS
# Link vSwitch0 used for Service Console communication to vmnic2 if the vmnic0 was not correct
/usr/sbin/esxcfg-vswitch -U vmnic0 vSwitch0 /usr/sbin/esxcfg-vswitch -L vmnic1 vSwitch0
# Add a vmkernel port for NAS access named NFSPort, with IP address of 172.30.0.101, and a default gateway of 172.30.0.1 (if required for routing)
/usr/sbin/esxcfg-vswitch -A NFSAccess vSwitch0
/usr/sbin/esxcfg-vmknic -a -i 172.30.0.101 -n 255.255.255.0 NFSport /usr/sbin/esxcfg-route 172.30.0.1
# Add an NFS datastore named NFSDatastore01 with an NFS server at 172.30.0.100 and a shared directory of ISOImages
/usr/sbin/esxcfg-nas -a -o 172.30.0.100 -s /ISOImages NFSDatastore01
# Enable the Service Console firewall to allow ntp and iSCSI client firewall ports
/usr/sbin/esxcfg-firewall -e ntpClient
/usr/sbin/esxcfg-firewall -e swISCSIClient
# Add a vmkernel port named VMotion on a virtual switch named vSwitch1. The VMkernel
port will have an IP address of 172.29.0.105
# and a subnet mask of 255.255.255.0
/usr/sbin/esxcfg-vswitch -a vSwitch1
/usr/sbin/esxcfg-vswitch -A VMotion vSwitch1
/usr/sbin/esxcfg-vswitch -L vmnic0 vSwitch1
/usr/sbin/esxcfg-vmknic -a -i 172.29.0.105 -n 255.255.255.0 VMotion
# Add a vswitch named vSwitch2 with a virtual machine port group named ProductionLAN
/usr/sbin/esxcfg-vswitch -a vSwitch2
/usr/sbin/esxcfg-vswitch -L vmnic2 vSwitch2 /usr/sbin/esxcfg-vswitch -A ProductionLAN vSwitch2
# Set up time synchronization for ESX Server
cat > /etc/ntp.conf << NTP
restrict default kod nomodify notap noquery nopeer
restrict 173.30.0.111
172.30.0.111
fudge 127.127.1.0 stratum 10
driftfile /etc/ntp/drift
broadcastdelay 0.008
authenticate yes
keys /etc/ntp/keys
NTP
cat > /etc/ntp/step-tickers << STEP
172.30.0.111
STEP
/sbin/service ntpd start
/sbin/chkconfig --level 3 ntpd on
# Update system clock
/sbin/hwclock --systohc --utc
# The --utc setting in the "timezone" command above eliminates the need for updating
the clock file
#cat > /etc/sysconfig/clock << CLOCK
#ZONE="UTC"
#UTC=true
#ARC=false
#CLOCK
# Allow incoming/outgoing communications on the Service Console via SSH.
esxcfg-firewall -e sshServer
esxcfg-firewall -e sshClient
# Rename the S11Post_Install_Config file to S11Post_Install_Complete after first execution. Since file name will now be incorrect it will
# not be triggered in subsequent ESX Server boot sequences. EOF dictates end of file.
mv /etc/rc.d/rc3.d/S11Post_Install_Config/etc/rc.d/rc3.d/S11Post_Install_complete
EOF
# Make the S11servercfg file an executable
/bin/chmod +x /etc/rc.d/rc3.d/S11Post_Install_Config
 

Оглавление книги


Генерация: 1.247. Запросов К БД/Cache: 3 / 1
поделиться
Вверх Вниз