In this chapter, we will cover the following topics:
Installing ESXi using Interactive Mode
Deploying ESXi hosts using scripted installation
Deploying ESXi hosts using Auto Deploy
Installing vSphere Client
Configuring NTP settings on ESXi hosts
Configuring DNS and Routing
Licensing an ESXi host
VMware ESXi is a hypervisor that is built directly on top of an x86 hardware. It abstracts the underlying hardware and allows multiple virtual machines to use the same hardware resources. It includes an ultra-thin architecture, and the footprint in the memory is 32 MB, which makes it more reliable and it only takes a few minutes to install. ESXi is offered in two different types: ESXi Embedded and ESXi Installable, and there is no functional difference between them. Both use the same code and provide us with the same functionality and features depending on the license used. The two different types of ESXi are explained as follows:
ESXi Embedded: This is available in the Original Equipment Manufacturer (OEM) format, and it is installed on a USB or an SD card when the hardware is being purchased. It saves the cost of purchasing additional hard drives and saves valuable time for vSphere administrators, as there is no need to install hypervisors.
vCenter is available in the following three editions:
The Essentials kit allows you to use up to three ESXi hosts, each with two physical processors, but this license only includes the hypervisor and does not include any other features
The Essentials Plus kit allows you to use up to three ESXi hosts, each with two physical processors, and this kit includes features such as vMotion, High Availability (HA), data protection, vShield end point, and vSphere replication, along with the vSphere hypervisor
If you are running more than three ESXi hosts in the environment and looking for more vSphere features, then you might consider using one of the following licenses:
A full comparison of the features included in each edition can be found at http://www.vmware.com/in/products/vsphere/compare.html.
Choosing hardware for vSphere deployments
You need to make sure that the right hardware is procured to perform the right job, and selecting the hardware plays a major role in the vSphere deployment. VMware has put together a list of supported servers and hardware after the vendors have done extensive testing. VMware Compatibility Guide (http://www.vmware.com/resources/compatibility/search.php) gives us the list of supported vendors and their hardware for the vSphere deployment.
As an example, the following screenshot is filtered to list the supported HP servers for ESXi:
VMware Compatibility Guide is not only for listing the supported servers but you can also drill down to list out the supported storage arrays, I/O devices, guest OS, and many other features.
Requirements for installing ESXi
Every traditional operating system needs to fulfill a certain hardware requirement for its successful installation; similarly, we have a set of hardware requirements that are required for ESXi installation:
A supported 64-bit processor with a minimum of two cores
CPU with support for LAHF and SAHF instructions
NX/XD bit enabled for the CPU in the BIOS
2 GB RAM is required for the successful installation of ESXi, but VMware recommends at least 8 GB RAM in the production environment
Hardware virtualization (Intel VT-x or AMD RVI) has to be enabled to run 64-bit virtual machines
A minimum of one Gigabit or 10 Gb network adapters
Deploying VMware ESXi
Once you have selected the hardware and fulfilled the requirements for the ESXi installation, you have to decide the deployment option for ESXi. Four deployment options are available and they are as follows:
The first three deployment methods will be covered in this chapter.
Make sure that the installer files are downloaded from http://www.vmware.com/download, and if the installation is performed remotely, make sure you have access to the hardware remote console (ILO, DRAC, RSA, and so on).
Now, let's look at the steps for installing ESXi:
Select ESXi-5.1.0-799733-standard Installer from the boot menu, as shown in the following screenshot:
The ESXi installer image will load, and it will present the following screenshot. Press Enter to continue.
Next, the installer will look for the list of available devices to install the ESXi and will display a list of both the local and the remote disks available for the host, as shown in the following screenshot:
Once you have confirmed the disk on to which the ESXi has to be installed, select the disk and press Enter to continue.
Select the desired keyboard layout and press Enter to continue.
If there any errors or warnings, it will be listed in the next screen; if everything looks good, you will be asked for a confirmation to install ESXi, as shown in the following screenshot. Press F11 to allow the installation to complete.
When the installation is complete, as shown in the following screenshot, remove the installation media and press Enter to reboot the server:
Change the root password
Configure the networking settings
Enable the ESXi shell and remote SSH to troubleshoot from the console
Restart management network and management agents
Perform network restore
Shutdown or restart/reboot ESXi hosts
View system logs
Remove custom extensions
Performing a scripted installation is an efficient way of deploying multiple ESXi hosts. The installation script (
ks.cfg) contains the installation and configuration parameters of ESXi. Using a scripted installation, you can make sure you have a similar configuration for your entire infrastructure. This makes it easy for deploying multiple ESXi hosts in a short amount of time.
Make sure that the hardware used is listed in VMware Compatibility Guide (http://www.vmware.com/resources/compatibility/search.php) for ESXi installation, also make sure that the ESXi installer ISO is available, and that the installation script is placed in any one of the following locations:
USB flash drive or USB storage device
A scripted installation can be performed using two different methods:
Ks=https://10.0.1.65/esxi/ks.cfg ip=10.0.1.150 netmask=255.255.255.0 gateway=10.0.1.1
ks=<location of installation script> <boot command line options>
The deployment of ESXi hosts can be fully automated using the PXE infrastructure where the options are passed through the
kerneloptline of the
boot.cfgfile is located in the installation media and the content would look similar to the following. Edit the
kerneloptsection by changing the script location for automating the deployment:
bootstate=0 title=Loading ESXi installer kernel=/tboot.b00 kernelopt=runweasel modules=/b.b00 --- /useropts.gz --- /k.b00 --- /
The location of the script file is entered when the installer is booted as shown in the following screenshot:
This uses the specified network address location when looking for a script
This uses the network gateway as the default gateway
This uses a static IP address
This looks for the specified domain name server
Subnet mask is specified for the network adapter
A specific vLAN ID is used for the network adapter
This uses the given URL to locate the installation script
This uses the scripts that are specified in the path
This uses the script that is located in the specified CDROM path
This looks for the
This uses the specified path on the USB disk for the installation script
VMware has made available a standard installation script that can be used, or you can create a customized script based on your environment with the required parameter. The standard installation script is located on ESXi under the
/etc/vmware/weasel path and the content of the
ks.cfg file would be as follows:
# # 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 # The install media is in the CD-ROM drive 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() )
In the previously mentioned script, the end user agreement will be accepted. The password for the host will be
mypassword, and this will obtain the IP address via DHCP on VMNIC0. The installation will happen on the first disk, and it will overwrite the existing VMFS partition. In case you are interested in using a customized script, you have the following list of commands:
--firstdisk: This command is used to specify the disk on which the installation/upgrade should happen; by default, the local disk will be chosen followed by the remote disk and USB. If you want to change the order, you need to specify the order as:
It is also possible to specify pre, post, and first boot sections with the help of Python or the
busybox interpreter command. If you want to enable SSH and create an additional vSwitch, you have to mention that in the first boot section with the help of ESXCLI and
vim-cmd. We will now see an example of enabling SSH in the first boot section:
%firstboot --interpreter=busybox #commands enable and start both Local and remote tech support mode vim-cmd hostsvc/enable_ssh vim-cmd hostsvc/start_ssh vim-cmd hostsvc/enable_esx_shell vim-cmd hostsvc/start_esx_shell
One caveat with the
%firstboot script is that any errors in the script will not be known until the installation is complete. If you just want to parse and check the kickstart file, you can use the
Auto Deploy is another method of deploying ESXi. With the help of Auto Deploy, you can specify the image to be deployed on the host. Auto Deploy is used in two different modes, Stateless caching and Stateful installs, which are explained next.
Stateless caching: In this method, the ESXi host configuration is not stored in the disk, but it's linked to an image profile. While rebooting the host, it uses the Auto Deploy server to boot, and when the server is not reachable, the host will boot from the local cache.
Stateful installs: In this method, the host is provisioned with Auto Deploy, but the host configuration and state are stored in the local disk. On every reboot, the host boots from the disk just as if it were installed using the ESXi Installer.
Auto Deploy components
The following figure depicts the Auto Deploy components:
Host profiles: This has been created with a reference host that will have the correct set of configuration, such as network, storage, and so on. This profile can be applied to another host to maintain a consistent configuration across the environment.
Make sure you have following components with you:
Auto Deploy binaries
PowerShell and PowerCLI binaries
ESXi 5.1 offline bundle file
The steps for installing Auto Deploy Server have been covered in Chapter 2, Installing and Using vCenter.
Now, let's see the steps involved in deploying ESXi:
Install the Auto Deploy Server and it can be installed on the vCenter Server or on a new server.
Install PowerShell and PowerCLI along with Auto Deploy and Image Builder cmdlets.
Install the TFTP server on vCenter and configure the TFTP root directory (for example,
Download the TFTP Boot Zip file from the Auto Deploy Server. It can be downloaded from the vCenter Server using vSphere Web Client. Navigate to vCenter Server | Manage | Auto Deploy | Download TFTP Boot Zip and extract the content under the TFTP root directory:
Make sure the host is set to PXE boot.
You can see the cmdlet in the following screenshot:
The deployment rule is a must, and it is created to assign an image profile to the servers, which are specified within the
Patternparameter. In the following example, we have created a rule name called Adrule, and this rule is applicable for the hosts that are within the specified IP range (10.1.1.200-10.1.1.225):
New-DeployRule –Name "Adrule"–Item "ESXi-5.1.0-799733-standard" –Pattern "ipv4=10.1.1.200-10.1.1.225
You can see the cmdlet in the following screenshot:
The rules that are created are not part of the rule sets until we add them manually, and there are two types of rule sets available: active rule set and working rule set. They are explained as follows:
The deployment rule that was created previously has to be added to the active rule sets, and this can be done with the help of the
Add-DeployRulecmdlet. By default, the rules will be added to both of the rules. If you wish to make the rule inactive, use the
The following syntax will add the rule to both active and working rule sets:
Add-DeployRule –DeployRule Adrule
Now, when you boot the physical host, it will start deploying the ESXi image.
Get-EsxImageProfile: This is used to list down the images that are added to the depots
New-EsxImageProfile: This is used to create a new image profile by cloning the existing one or by creating an image profile from scratch
Export-EsxImageProfile: This is used to export the image profile as an ISO or ZIP file once the packaging is done
New-DeployRule: This is used to create a deployment rule, which matches the physical host configuration such as the host hardware or the servers, that is within a specific IP range
Add-DeployRule: This is used to add rules to the working rule sets
Get-DeployRuleSet: This lists the current working or active rule set
Now that we have seen the deployment of ESXi, the next step will be to configure the ESXi host, which is done using the vSphere Client. As an alternative to the vSphere Client, the vSphere Web Client provides a web interface for interaction with the vCenter Server system and manages the ESXi hosts through a browser. We will learn more about the vCenter Server and vSphere Web Client in Chapter 2, Installing and Using vCenter.
With the release of vSphere 5.1, VMware has made an entire new feature available only via the Web Client if the host is managed by the vCenter Server.
The installer of the vSphere Client can be found in vCenter Server Installation Media. Alternatively, you can download the installer by accessing the ESXi host via a web browser where you will find a link to download the vSphere Client, which will be redirected to vsphereclient.vmware.com.
Run the VMware vSphere Client installer.
Select Language and click on OK.
Click on Next in the Welcome to the installation screen.
Click on Next in the End User Patent Agreement window.
Accept the End User Agreement and click on Next.
Change the Destination folder if required and click on Next.
Select Install in the Ready to install program screen.
Allow the installation to complete and click on Finish when done.
ESXi uses the UTC time by default, and it's not possible to change the time zone on the ESXi host. To ensure that we maintain the correct time system across the environment, it is recommended to synchronize the ESXi host with NTP servers.
Before you start with the NTP configuration, make sure that you have the NTP server details and access to the ESXi host.
Under the Configuration tab, click on Time Configuration under Software.
Click on Properties... on the top-right corner:
Select NTP Client Enabled and click on Options..., as shown in the following screenshot:
Under the General section in the left pane, select the appropriate Startup Policy as per your environment. VMware recommends that you choose Start automatically if any ports are open, and stop when all ports are closed:
Select NTP Settings on the left pane, click on Add, enter the IP Address of your NTP source, and click on OK.
Select Restart NTP service to apply changes checkbox and click on OK.
Alternatively, the NTP setting can be configured using the PowerCLI cmdlet,
Add-VmHostNtpServer, which will help us configure the NTP setting. Make sure you connect to the vCenter Server from PowerCLI and use the following command:
Add-VmHostNtpServer -NtpServer "IP Address" -VMHost (Get-VMHost)
As an alternative, you can connect to the ESXi host using PowerCLI and execute the following command:
Add-VmHostNtpServer -NtpServer "IP Address"
Make sure that you have the DNS and default gateway details before starting the configuration.
Now, let's see the steps involved in creating the DNS records:
Login to the ESXi host using the vSphere Client.
Click on Properties on the top-right corner of the screen.
In the DNS configuration, review the current configuration and make the necessary changes, such as the hostname, Domain, DNS server, and search domain fields:
Connect to the ESXi console and Press F2 to log in to DCUI.
In the System Customization screen, move the cursor down and select Configure Management Network:
If required, make the changes on the screen and press Enter and exit the screen.
You will be presented with the DNS configuration where you need to enter the DNS Server IP address and hostname of the ESXi host. When you have finished entering the details, press Enter to exit the screen.
In Custom DNS Suffixes, modify the suffixes as required, press Enter for OK, and exit the screen:
Now, you need to save the configuration that has been changed, so from the Configure Management Network, press Esc to exit and you will be asked for confirmation on the Configure Management Network scene:
You will then be back on the System Customization screen; if you want to make sure that the configuration is correct, you can perform the test management network operation. To proceed with the test, select Test Management Network and press Enter.
The ESXi host will try to ping the DNS servers and the default gateway and resolve the configured hostname:
By default, when you install an ESXi host, it will run in the evaluation mode for 60 days. After this period, you need to assign a license key to the host. If you are using vCenter, the license management will be done at the vCenter level by adding the license keys on vCenter and assigning them to the appropriate ESXi host. If you have only a standalone ESXi host, then you have to assign the license directly on the ESXi host.
Connect to the ESXi host using the vSphere Client.
Select the Configuration tab in the right pane and select Licensed Features under Software.
Click on Edit on the top-right corner of the screen.
Select the Assign a new license key to this host radio button: