VCP 6 Study Note – Multiple ways to install ESXi
All of us know the direct installation via media, which is the most used by many folks during “poor” cluster installation (up to 6 nodes installation). But in this post I would highlight other installation methods, extracting pieces of infos from official docs:
Scripted installation
It’s possible to perform scripted way to install and upgrade esxi host. The installation/upgrade script must reside in these location:
- FTP server
- HTTP/HTTPS server
- NFS server
- USB Flash drive
- CD-ROM drive
Scripted installation could be performed with these options:
- Install on first disk on multiple machines (one script)
- Install on different machine disks for each machine
The way to perform scripted installation are:
- via Boot Options using installation media (Shift+O before booting in interactive installation) (here the command using in this method: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-9040F0B2-31B5-406C-9000-B02E8DA785D4.html )
- via CD or DVD: creating a custom ISO with modified ks.cfg, then launch then using Shift+O to start custom script with ks=…
- via USB Flash drive: the same as CD DVD, but creating a bootable USB Flash Drive starting from ESXi installation ISO.
- Using PXE (via DHCP and TFTP) and providing ks.cfg via TCP
About script
The installation script ks.cfg contains commands to be used during installation:
- accepteula or vmaccepteula (required)
- clearpart (optional) –> clear existing partitions
- dryrun (optional) -> check only
- install –> fresh installation
- installorupgrade
- keyboard (optional)
- serialnum or vmserialnum –> specify license key
- network (optional)
- paranoid (optional) –> waring messages interrupts installation
- part or partition (optional) –> creates additional VMFS datastore
- reboot (optional)
- rootpw (required) –> root password
- upgrade
- %include or include (optional) –> include more file cfg (example %include part.cfg)
- %pre (optional) –> script to run before the kickstart configuration is evaluated
- %post (optional) –> script after package installation is complete
- %firstboot –> init script that runs only during the first boot
Boot loader confg file is located in boot.cfg., and includes kernel options and modules to use during installation.
Example:
1 2 3 4 5 6 7 8 9 10 |
# boot.cfg -- mboot configuration file # # Any line preceded with '#' is a comment. title=ST<var>RING</var> kernel=F<var>ILEPATH</var> kernelopt=S<var>TRING</var> modules=F<var>ILEPATH1</var> --- F<var>ILEPATH2</var>... --- F<var>ILEPATHn</var> # Any other line must remain unchanged. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# # Sample scripted installation file # # Accept the VMware End User License Agreement vmaccepteula # Set the root password for the DCUI and Tech Support Mode rootpw mypassword # Install on the first local disk available on machine install --firstdisk --overwritevmfs # Set the network to DHCP on the first network adapter network --bootproto=dhcp --device=vmnic0 # A sample post-install script %post --interpreter=python --ignorefailure=true import time stampFile = open('/finished.stamp', mode='w') stampFile.write( time.asctime() ) |
Auto Deploy
Auto deploy method is useful to deploy hundred of ESXi hosts, specifying image to deploy and the host to provision and optionally attach an host profile.
Auto Deploy uses PXE boot infrastructure in conjunction with vSphere host profiles to provision and customize that host. It stores the information for the ESXi hosts to be provisioned in different locations. Following the sotres information:
- Image state (exec to run ESXi host and created with PowerCLI Image Builder)
- Configuration state (Config settings eg: vSwitch, driver settings and boot parameters)
- Dynamic State (Runtime state like generate private keys)
- Virtual machine state (VM stored on a host and VM autostart info)
- User input (store based on user input like IP address,… )
It’s possible to specify the behavior of the Auto Deploy server by using a set of rules written in PowerCLI. Rules engine maps software and configuration settings to hosts based on the attributes of the host. The rules engine includes rules and rule sets:
- Rules: can assign image profiles and host profiles to a set of hosts, or specify the location (folder or cluster) of a host on the target vCenter Server system. can identify hosts by:
- boot MAX address
- SMBIOS info
- BIOS UUID
- Vendor
- Model
- fixed DHCP IP address
- Active Rule Set: when host contacts auto deploy server, active rule set will checks before provide image profile.
- Working Rule Set: allows to test changes before making change active.
Rule workflow:
- Make changes to working rule set
- Use cmdlets to execute the working rule
- Refine and retest the rules
- Activate the rules in working rule set
There are some prerequisite for the First Boot:
- Set up a DHCP server that assigns an IP address to each host upon startup and that points the host to the TFTP server to download the iPXE boot loader from
- Verify that the Auto Deploy server has an IPv4 address. PXE booting is supported only with IPv4
- Identify an image profile to be used (ESXi profile public image or create new with PowerCLI Image Builder )
- Optional: If you have a reference host in your environment, export the host profile of the reference host and define a rule that applies the host profile to one or more hosts
- Specify rules for the deployment of the host and add the rules to the active rule set
First Boot process:
Boot process:
- When the administrator turns on a host, the host starts a PXE boot sequence –> DHCP assign IP to cotact TFTP server
- The host contacts the TFTP server and downloads the iPXE file and iPXE config file
- iPXE starts executing –> make HTTP boot request to Auto Deploy Server
- Auto Deploy perform_
- query rules engine
- Streams components specified in image profile (and optional vCenter location info)
- The host boots using the image profile
- Auto Deploy adds the host to the vCenter Server system that Auto Deploy is registered with.
- Optional: If the host profile requires the user to specify certain information, such as a static IP address, the host is placed in maintenance mode when the host is added to the vCenter Server system. It is necessary to reapply host profile and update host customization before exit maintenance mode.
- If the host is part of a DRS cluster, virtual machines from other hosts might be migrated to the host after the host has successfully been added to the vCenter Server system
Quickstart
- Install vCenter and vCenter Server components (or vCenter Server Appliance) –> Auto Deploy is included in management node
- Install PowerCLI
- Find image profile that includes VIBs you want deploy to hosts:
- Add the depots containing the required software to your vSphere PowerCLI session
- To create a custom image profile, use Image Builder cmdlets to clone an existing image profile and add the custom VIBs to the clone
- Use the New-DeployRule vSphere PowerCLI cmdlet to write a rule that assigns the image profile to one host, to multiple hosts specified by a pattern, or to all hosts
- Power on the host to have Auto Deploy provision the host with the specified image profile.
- Set up the host you provisioned as a reference host for your host profile
- Create and export a host profile for the reference host.
- To provision multiple hosts, you can use the Copy-DeployRule cmdlet
- Power on the hosts that you want to provision
- Verify that the hosts you provisioned meet the following requirements
- Each host connected to vCenter
- hosts are not in maintenance mode
- hosts have no compliance failures
- each host with host profile with user input has up-to-date informations
In depth there are more steps to do preparing a vSphere with Auto Deploy environment:
- Prepare system and Install: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-21FF3053-F77C-49E6-81A2-9369B85F5D52.html
- Auto Deploy PowerCLI Cmdlet Overview https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-16E1D78F-2466-4794-8D12-BE5EC7AA41D3.html
- Using Auto Deploy Cmdlet https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-30C5FD99-2771-4766-8860-AF8CA9BA41F3.html
- Setup Bulk Licensing: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-48AEE987-B2AC-432A-8FDB-3DB255C4A511.html
Auto Deploy Proof of Concept Setup: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-A9FFEDEE-1A3D-4EFD-A130-F6E78C727380.html
Image Builder
vSphere ESXi Image Builder is a set of vSphere PowerCLI cmdlets that you can use to manage vSphere image profiles and VIB packages, such as driver VIBs and update VIBs. Before you can run vSphere ESXi Image Builder cmdlets, you must install vSphere PowerCLI and all prerequisite software: ESXi Image Builder snap-in is included with the vSphere PowerCLI installation.
With ESXi Image Builder is possible to:
- Clone Image Profile (New-EsxImageProfile –CloneProfile … )
- Add VIBs to an Image Profile (Add-EsxSoftwarePackage -ImageProfile My_Profile…)
- Export Image Profile to ISO (or Offline ZIP Bundle) (Export-EsxImageProfile -ImageProfile “myprofile”…)
- Preserve Image Profile Across Sessions
- Compare Image Profiles
- Compare VIBs
Here vSphere Image Builder Workflows: https://pubs.vmware.com/vsphere-60/index.jsp#com.vmware.vsphere.install.doc/GUID-724A9B8F-968F-42C0-A286-1F5197E0604E.html