150 likes | 341 Views
VMware ESXi 4.x Scripted Installation. Phoenix VMUG March 2, 2011. Before the ESXi installer Welcome Screen appears, the installer displays a boot prompt where you can enter boot commands to pass argument s to the installer.
E N D
VMware ESXi 4.x Scripted Installation Phoenix VMUG March 2, 2011
Before the ESXi installer Welcome Screen appears, the installer displays a boot prompt where you can enter boot commands to pass argument s to the installer. When the modes selection screen appears, quickly press Tab to stop the timeout counters. If the mode selection screen times out, the default interactive mode is launched.
Boot commands must be entered after the file “vmkboot.gz” rather then at the end of the line. For example, Append vmkboot.gz ks=http://00.00.00.00/kickstart/ks-osdc-pdp101.cfg --- vmkernel.gz ---- sys.vgz --- cim.vgz --- ienviron.vgz --- install.vgz
Next change the “Boot Command” by modifying the line option, after the “vmkboot.gz” with the following command. See the example below. Ex: mboot.c32 vmkboot.gz ks=nfs://nas2.acme.com/vol/esx/ks/hostname.cfg --- vmkernel.gz --- sys.vgz --- cim.vgz --- inenviron.vgz --- install.vgz
The command will reference the kickstart file (hostname.cfg) for the main configuration parameters for your ESX server. After the installation is complete, a post installation script that is integrated in to the kickstart file, will be automatically executed when the server is rebooted. The post installation script will perform the following steps: • Modifies the search parameters to set the local DNS search strings. • Adds additional DNS servers for redundancy. • Adds additional host entries. • Setups the switch for vmkernel, and Network0 or appropriate vlan ports. • Configures the remaining NICs and the Active, Standby NIC configuration. • Sets Rolling Failover to No. • Enable VMotion on the VMKernel portgroup. • Adds a NAS “Restore” point for file restore process. • Adds a NAS “ISO” point for installing guest OS. • Adds a NAS “VMNAS” datastore. • Custom NFS advanced configuration setting • Restart virtual management interface and put the host into maintenance mode.
A Look At The Script:Basic System Information • rootpw 2newpwd • install nfs --server=nas2.acme.com --dir=/vol/esx/install • autopart --firstdisk --overwritevmfs • network --addvmportgroup=0 --device=vmnic0 --vlanid=10 --bootproto=static --ip=192.168.1.100 --netmask=255.255.255.0 --gateway=192.168.1.1 --nameserver=192.168.1.4,192.168.1.5 --hostname=vmhost1.acme.com • accepteula
A Look At The Script:vSwitch and Portgroup Config • %firstboot --unsupported --interpreter=busybox • #Assign VLAN to Management PortGroup • esxcfg-vswitch -v10 -p 'Management Network' vSwitch0 • #Add vMotion Portgroup to vSwitch0 • esxcfg-vswitch -A vmkernel vSwitch0 • #Add pNIC vmnic2 to vSwitch0 • esxcfg-vswitch -L vmnic2 vSwitch0 • #Assign ip address to vMotion vmk1 • esxcfg-vmknic -a -i 192.168.1.101 -n 255.255.255.0 -p vmkernel • #Assign VLAN to vMotion PortGroup • esxcfg-vswitch -v 10 -p vmkernel vSwitch0
A Look At The Script:vSwitch and Portgroup Config • #Create vSwitch1 • esxcfg-vswitch vSwitch1 -a • #Add pNIC vmnic1 to vSwitch1 • esxcfg-vswitch -L vmnic1 vSwitch1 • #Add pNIC vmnic3 to vSwitch1 • esxcfg-vswitch -L vmnic3 vSwitch1 • #Add Network0 Portgroup to vSwitch1 • esxcfg-vswitch -A Network0 vSwitch1 • #Add VLAN50 Portgroup to vSwitch1 • esxcfg-vswitch -A VLAN50 vSwitch1 • #Assign VLAN to Network0 PortGroup • esxcfg-vswitch -v 10 -p Network0 vSwitch1 • #Assign VLAN to VLAN50 PortGroup • esxcfg-vswitch -v 50 -p VLAN50 vSwitch1
A Look At The Script:vMotion and NIC Policy Config • sleep 10 • #set vMotion to vmk • vim-cmd hostsvc/vmotion/vnic_set vmk1 • #Set NIC order policy for port groups • vim-cmd hostsvc/net/vswitch_setpolicy --nicorderpolicy-active=vmnic0 vSwitch0 • vim-cmd hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby=vmnic2 vSwitch0 • vim-cmd hostsvc/net/vswitch_setpolicy --nicorderpolicy-active=vmnic1 vSwitch1 • vim-cmd hostsvc/net/vswitch_setpolicy --nicorderpolicy-standby=vmnic3 vSwitch1 • vim-cmd hostsvc/net/refresh
A Look At The Script:vSwitch Failover Policy • sleep 10 • vim-cmd hostsvc/net/vswitch_setpolicy -–nicteaming-policy=rollingorder • vim-cmd hostsvc/net/vswitch_setpolicy --nicteaming-rollingorder=true vSwitch0 • vim-cmd hostsvc/net/vswitch_setpolicy --nicteaming-rollingorder=true vSwitch1
A Look At The Script:NFS Datastores • esxcfg-nas -a iso -o nas1.acme.com -s /vol/nas/iso • esxcfg-nas -a vmnas0 -o nas1.acme.com -s /vol/nas/vmnas0 • vim-cmd hostsvc/net/refresh
A Look At The Script:DNS Configuration • vim-cmd hostsvc/net/dns_set --ip-addresses=192.168.1.4,192.168.1.5 • vim-cmd hostsvc/net/dns_set --searchdomain=acme.com
A Look At The Script:NFS Advance Config • esxcfg-advcfg -s 30 /Net/TcpipHeapSize • esxcfg-advcfg -s 120 /Net/TcpipHeapMax • esxcfg-advcfg -s 10 /NFS/HeartbeatMaxFailures • esxcfg-advcfg -s 12 /NFS/HeartbeatFrequency • esxcfg-advcfg -s 5 /NFS/HeartbeatTimeout • esxcfg-advcfg -s 64 /NFS/MaxVolumes
A Look At The Script:Technical and Maintenance Mode Enable SSH TechSupportMode – Not Recommended • vim-cmd hostsvc/enable_remote_tsm • vim-cmd hostsvc/start_remote_tsm • vim-cmd hostsvc/net/refresh • sleep 10 • # Put the host into maintenance mode and reboot the server • vim-cmd hostsvc/maintenance_mode_enter
Script References ESXi Installable and vCenter Server Setup Guide http://www.vmware.com/pdf/vsphere4/r41/vsp_41_esxi_i_vc_setup_guide.pdf Deploying ESXi 4.1 using the Scripted Install feature http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1022263 How To: Sample kickstart file for VMware ESXi 4.1 http://zenhat.wordpress.com/2010/09/11/how-to-sample-kickstart-file-for-vmware-esxi-4-1/ Automating ESXi 4.1 Kickstart Tips & Tricks http://www.virtuallyghetto.com/2010/09/automating-esxi-41-kickstart-tips.html ESXi 4.1 Kickstart Install - WIP http://www.kendrickcoleman.com/index.php?/Tech-Blog/esxi-41-kickstart-install-wip.html# ESXi 4.1 scripted install command reference http://communities.vmware.com/message/1589848#1589848 Getting a kick script beyond the basics to work http://communities.vmware.com/thread/278400 VMware ESX host command line configuration script http://www.vadapt.com/2009/04/vmware-esx-host-command-line-configuration-script/