Creating an Automated ESXi Installer

Back in the summer, I saw Stu’s Post about automating the installation of ESXi. I was reminded again by Duncan’s Post. Then, I found myself in a situation when a customer bought 160 blades for VMware ESXi. With this many systems, it would be almost impossible to do this without mistakes. I took the ideas from Stu and Duncan and created an ESXi automated installer that works from a PXE deployment server, like the Ultimate Deployment Appliance. I took it a step further and added the ability to use a USB stick or a CD for those times when PXE is not allowed. The document below is a result of it.

This is a little different than the idea of a stateless ESXi server, where the hypervisor actually boots from PXE. This is the installer booting from PXE so that the hypervisor can be installed on local disk, an internal USB stick or SD card. You could also use it for a “boot from SAN” situation, but extreme care should be taken so you don’t accidentally format a VMFS disk.

As always, if anyone has comments, corrections, etc., please feel free to post a comment below.

Summary

The ability to use an automated, unattended installation routine for a hypervisor is necessary whenever it is deployed to multiple systems or is done frequently. Automated installations help avoid a misconfiguration caused by human error, which become common when repetitive tasks are performed.  Because the “traditional” version of VMware ESX Server contains a Red Hat Linux based console operating system, we have been able to leverage kickstart scripts for automated installation. With the ESXi hypervisor, much of this functionality is not available because of the smaller footprint.

This document explains how to set up ESXi with little intervention. The modifications explained here can be used to deploy ESXi using a PXE server. In our examples we will use the Ultimate Deployment Appliance, but these methods will also transfer to such commercial packages as HP Rapid Deployment Pack, Altiris, or even a home grown PXE server. The modifications can also be used for deploying ESXi using a USB stick or a customized CD.

Requirements

  • ESXi Server Installable The ESXi CD image can be downloaded from the VMware site, however using a systems management and monitoring server, such as HP SIM or Dell OpenManage is highly recommended. Since there are usually vendor specific CIM providers to enhance the monitoring capabilities, some vendors will provide a customized CD image with the CIM providers. These additional CIM providers will also allow for more information to be displayed in the hardware sections of the vSphere Client. A search for “ESXi” on the HP and Dell sites produced links to the latest customized images.
  • Deployment Server A deployment server will allow for a controlled, automated installation of the ESXi Server software. The ability to handle multiple operating system installations is also desired. The ability to provide PXE and DHCP services is required as well. Most times, the deployment server will be running PXE services and TFTP. The DHCP services may be running on a different server in an enterprise. This document does not explain how to set up a separate DHCP server. For this document, we will be using the Ultimate Deployment Appliance (UDA) version 2.0 (beta).
  • Virtualization Software The UDA runs as a “Virtual Appliance,” which is a pre-configured virtual machine. It will run under VMware ESXi (available as a free or licensed instance), VMware Workstation (available for purchase), VMware Player (free) or VMware Server (free). In this document, VMware Workstation is used.
  • Optional software Although no additional software is required when using the UDA, you will need additional software if you plan on using a USB stick or if you plan on creating a customized CD image:
    • VMware Converter If you plan on using ESXi or Server to host the UDA, VMware Converter can be used to import the virtual appliance.
    • Syslinux In order to make a bootable USB stick, you will need the syslinux utility. This utility is available for Linux and Windows. The UDA does not include it. As an alternative, you can use the unetbootin utility.
    • CD Imaging and Burning In order to create a bootable CD image, you will need software to create the CD image (mkisofs) and then software to burn the image to the CD media (cdrecord). The cdrtools project includes versions for Linux and Windows. Most Debian versions of Linux, such as Ubuntu, come with the cdrkit, which uses genisoimage for imaging and wodim for burning.
    • Linux Desktop If you look at the contents of the ESXi CDs using Windows (Windows 7 was used), you may see all of the files listed using all capital letters. Since the ESXi software is based on Linux, all file operations are case sensitive and expect the files to be all lower case. This may cause errors when attempting to create the automated installer. For this reason, a Linux desktop is recommended. For most of the operations, UDS may be used. The only missing software on the UDA is syslinux. For a feature rich Linux desktop, Ubuntu is recommended. A few pre-configured Ubuntu Desktop virtual appliances are also available.

Conclusion

Once you have a hypervisor installed you will need to configure the server and add it to vCenter in an automated fashion. Look for a future doc covering this. For now, check out these resources for post install configurations:

http://communities.vmware.com/docs/DOC-7364

http://communities.vmware.com/docs/DOC-7511

http://communities.vmware.com/docs/DOC-8170

19 Replies to “Creating an Automated ESXi Installer”

  1. Hi there,

    nice howto, but is it possible to skip the prompt for the target disk so that the server just uses the one that is available?

    Thanks
    T-One

  2. @T-One
    The best I can say at this moment is what is in the PDF:

    “The steps called out in this script refer to steps located in the following file:
    /usr/lib/vmware/installer/ThinESX/ThinESXInstallSteps.py
    If you understand Python scripting, you can edit this file to change the way the steps operate if you wish. ”

    I am sorry if that doesn’t help.
    Dave

  3. Excellent article Dave, works like a dream!

    Just what I need for rapidly building hosts in a lab environment – many thanks.

    Nigel

  4. I will be updating the doc later. Basically, to get it to install to a local disk you can do the following:

    Edit “ThinESXInstallSteps.py”

    Remove (or comment out) the following line:
    return LaunchDialog(DeviceSelectionDialog(targets, data))

    Replace with:
    luns = [lun for lun in targets if lun.IsLocal()]
    firstLocalLun = luns[0]
    data[‘Target’] = firstLocalLun
    data[‘TargetPrettyName’] = firstLocalLun.GetConsoleDevice()
    return data

    I have not tried this with SAN attached disk, so caution should be taken before doing this!
    Dave

  5. I will be updating the doc later. Basically, to get it to install to a local disk you can do the following:

    Edit “ThinESXInstallSteps.py”

    Remove (or comment out) the following line:
    return LaunchDialog(DeviceSelectionDialog(targets, data))

    Replace with:
    luns = [lun for lun in targets if lun.IsLocal()]
    firstLocalLun = luns[0]
    data[‘Target’] = firstLocalLun
    data[‘TargetPrettyName’] = firstLocalLun.GetConsoleDevice()
    return data

    I have not tried this with SAN attached disk, so caution should be taken before doing this!
    Dave

  6. Dave,

    That was helpful, but installing from USB the FirstLocalLun installes to the USB i’m installing from (which is a good trick I thought),
    so how do I get the second device?

  7. Dave,

    That was helpful, but installing from USB the FirstLocalLun installes to the USB i’m installing from (which is a good trick I thought),
    so how do I get the second device?

  8. @DanV
    This is meant to install to only the first local LUN. It is also intended to be run on a system that is not connected to any other LUNs. I am not sure why you would want to install on a different drive.

  9. @DanV
    This is meant to install to only the first local LUN. It is also intended to be run on a system that is not connected to any other LUNs. I am not sure why you would want to install on a different drive.

  10. Thanks for your quick reply…

    I need to push the install to the second LUN because the USB flash drive that I’m installing from shows up as the first local LUN, then ESXi automagiklly installs to the USB. I’d like it to the internal SAS drives (HP DL380G6).

    I did some searching at :
    http://docs.python.org/search.html?q=GetConsole
    for any of those Python cpommands, and cannot find them.

  11. Thanks for your quick reply…

    I need to push the install to the second LUN because the USB flash drive that I’m installing from shows up as the first local LUN, then ESXi automagiklly installs to the USB. I’d like it to the internal SAS drives (HP DL380G6).

    I did some searching at :
    http://docs.python.org/search.html?q=GetConsole
    for any of those Python cpommands, and cannot find them.

  12. Really Good blog once again big thanks. Just had someone on our vTeam wondering about these things and they seem pretty sure they are going to a PXE boot style. Now we just need a plan for upgrading 700+ ESX host to ESXi. Really dont have any idea where to start there….

  13. Really Good blog once again big thanks. Just had someone on our vTeam wondering about these things and they seem pretty sure they are going to a PXE boot style. Now we just need a plan for upgrading 700+ ESX host to ESXi. Really dont have any idea where to start there….

  14. Dear All,
    Doing “Step by Step” I encountered the following issue:

    [root@uda20 install]# tar -zxvf /var/public/tftproot/esxi4u1/install.tgz

    gzip: stdin: not in gzip format
    tar: Child returned status 1
    tar: Error exit delayed from previous errors

    Does anybody have a solution?

    Thanks,

Leave a Reply