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 --server=27000@172.30.0.2 --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
Postinstallation Configuration
Once the installation of ESX Server is complete, there are several postinstallation changes that either must be set or are just strongly recommended. Among these configurations are adjusting the amount of RAM allocated to the Service Console, changing the physical NIC used by the Service Console, and configuring the ESX Server host to synchronize with an external Network Time Protocol (NTP) server.
During the installation of ESX Server, the NIC selection screen creates a virtual switch bound to the selected physical NIC. The tricky part, as noted earlier, is choosing the correct PCI address that corresponds to the physical NIC connected to the physical switch that makes up the logical IP subnet from which the ESX Server will be managed. The problem often arises when the wrong PCI address is selected, resulting in the inability to access the Service Console. Figure 2.32 shows the structure of the virtual networking when the wrong NIC is selected and when the correct NIC is selected.
Читать дальше
Конец ознакомительного отрывка
Купить книгу