Documente Academic
Documente Profesional
Documente Cultură
Creating an Automated ESXi Installer by David Convery is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Pg 2 of 29
www.dailyhypervisor.com/
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: o VMware Converter If you plan on using ESXi or Server to host the UDA, VMware Converter can be used to import the virtual appliance.
Pg 3 of 29
www.dailyhypervisor.com/
Pg 4 of 29
www.dailyhypervisor.com/
Pg 5 of 29
www.dailyhypervisor.com/
Use the arrow keys to navigate. Type the IP address, subnet mask and gateway information. Hit <ENTER>.
Use the arrow keys to navigate and <SPACE> to select. In our case we are enabling all services. Hit <ENTER>.
Use the arrow keys to navigate. Enter the IP address pool for the DHCP services. Hit <ENTER>.
The root and admin accounts use the same password. Type the password and hit <ENTER>.
Pg 6 of 29
www.dailyhypervisor.com/
CONGRATULATIONS! You have installed your Ultimate Deployment Appliance. Easy huh?
Pg 7 of 29
www.dailyhypervisor.com/
Using your browser, enter the IP address for the UDA. You will be prompted to log in. Use admin and the password you entered during setup.
Pg 8 of 29
www.dailyhypervisor.com/
In the Local Storage screen, select the systemlv volume and then click on the Extend button.
Pg 9 of 29
www.dailyhypervisor.com/
When completed, click the System link and repeat the process for the LVM and locallv volume.
Now your UDA has sufficient space for CD Images and PXE boot files.
Pg 10 of 29
www.dailyhypervisor.com/
Pg 11 of 29
www.dailyhypervisor.com/
In the File Upload screen, browse and select the CD image you wish to upload.
Pg 12 of 29
www.dailyhypervisor.com/
Pg 13 of 29
www.dailyhypervisor.com/
Type in a Template Name and select VMware ESXi 4 Installable. Click on the Next button.
Pg 14 of 29
www.dailyhypervisor.com/
In the Templates screen, select the template that you just created and click on the Configure button.
Notice that there are several boot line entries that all begin with [OS].[FLAVOR].
Pg 15 of 29
www.dailyhypervisor.com/
Replace all instances of [OS].[FLAVOR]. with esxi4u1 without the quotes. When completed, click on the Save button.
At this point, the framework has been set for PXE booting. Now we need to get the files where they need to go.
Pg 16 of 29
www.dailyhypervisor.com/
Open a console to the UDA and log in as root with the password you entered during setup.
NOTE: The following commands are case sensitive. First, we need to create the directory for the ESXi installer files. Type:
mkdir /var/public/tftproot/esxi4u1
And hit <ENTER>. In order to mount the CD image, we need to create a mount point. This is a directory that will act as a placeholder for the files. Type:
mkdir /mnt/esxi
And hit <ENTER>. Now that you have your directories created, you will need to mount the CD image. In the command listed below, substitute CD_Image_Name with the name of the CD image you will be using. Type:
mount o loop /var/public/smbmount/local/CD_Image_Name /mnt/esxi
Pg 17 of 29
www.dailyhypervisor.com/
At this point, you have a set of useable PXE files for installing ESXi. Using them as is will result in a prompted installation.
Pg 18 of 29
www.dailyhypervisor.com/
The WelcomeStep and LicenseStep can be removed, since they are not necessary for the installation. The TargetSelectionStep is used to select where to install the hypervisor. This step will remain in this example. The ConfirmStep can also be removed. The WriteStep and PostConfigStep are both required and should not be removed. The CompleteStep is optional. This step basically informs you that the installation is complete and to hit <ENTER> to reboot. It can be removed if you are OK with the server rebooting automatically on completion. If your server is set up properly, it will PXE boot until the OS is installed and then it will boot to the local storage. The RebootStep is required to cause the server to reboot at the end.
Once edited, the lines will look like this for PXE boot:
Steps = [TargetSelectionStep, WriteStep, PostConfigStep, RebootStep ]
If you plan on using a USB stick or CD based installation, edit it to look like this:
Steps = [TargetSelectionStep, WriteStep, PostConfigStep, CompleteStep, RebootStep ]
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.
Pg 19 of 29
www.dailyhypervisor.com/
And hit <ENTER>. Now, we need to uncompress the install.tgz archive. Type:
tar zxvf /var/public/tftproot/esxi4u1/install.tgz
And hit <ENTER>. Once you have extracted the files, you can list the contents. Type:
ls
And hit <ENTER>. Now we want to change to the directory that holds the Python script to be edited. Type:
cd usr/lib/vmware/installer
Pg 20 of 29
www.dailyhypervisor.com/
Type:
chmod +w ThinESXInstall.py
Then hit <ENTER>. You can confirm the write permission is set by typing the ls command.
l
Now that you can write to the file, you will need to edit it. In this example, we will use vi but you can also use nano if you wish.
HINT: you can use dw to cut a word and then p to paste it. When finished, use :wq to write and quit.
Pg 21 of 29
www.dailyhypervisor.com/
Then hit <ENTER>. Now, we need to create a new compress archive file. Type:
tar czvf ../install.tgz *
Then hit <ENTER>. Once completed, change up to the /tmp directory. Type:
cd ..
Then hit <ENTER>. Copy the new archive file to the PXE template directory. Type:
cp install.tgz /var/public/tftproot/esxi4u1
Pg 22 of 29
www.dailyhypervisor.com/
Now, we need to edit the file named default and make some changes. In this example, we will use vi but you can also use nano for this.
Edit the section to add the menu default and the timeout 100 lines:
label ESXi4U1_Unattended menu label ESXi4U1_Unattended menu default timeout 100 # no password kernel vesamenu.c32 append pxelinux.cfg/templates/ESXi4U1_Unattended.menu
Pg 23 of 29
www.dailyhypervisor.com/
If the system is configured properly, it will PXE boot over the network.
The UDA menu will appear for 10 seconds. Just hit <ENTER> if you want to speed things up.
Pg 24 of 29
www.dailyhypervisor.com/
Insert the USB stick into the system that will be used to make it bootable. If a mount is not displayed in a Linux system, you can use the fdisk l command to display the disk information. In this example, it is located on /dev/sdb1 (Notice the FAT16) On a Windows system, it will be a drive letter, such as E: In Linux you will use the following command:
sudo syslinux sf /dev/sdb1
The sudo command is used if you are not logged in as root. Substitute /dev/sdb1 with the device path listed from the fdisk command. In Windows, you will need to open a CMD prompt as an administrator and use the following command:
syslinux sfma E:
Pg 25 of 29
www.dailyhypervisor.com/
Use the fdisk l command to find the device path to the USB stick. In this example, it is /dev/sdd1 (Notice the FAT16)
Make a directory for the USB mount point. Then mount the stick and copy the files to it. Type:
mkdir /mnt/usb mount /dev/sdd1 /mnt/usb cp v /var/public/tftproot/esxi4u1/* /mnt/usb
You will also need to rename (move in Linux) the isolinux.cfg file to syslinux.cfg
mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg
You will need to edit the /mnt/usb/syslinux.cfg file to make the ESXi Installer the default menu item. Look for the following lines:
label ESXi Installer menu label ^ESXi Installer kernel mboot.c32 append vmkboot.gz --- vmkernel.gz --- sys.vgz --- cim.vgz --- ienviron.tgz -- image.tgz --- install.tgz
Pg 26 of 29
www.dailyhypervisor.com/
Then, unmount the USB stick to make sure all writes are flushed.
umount /mnt/usb
Change to the /var/public/tftproot/esxi4u1 directory. You can use the ls command to list the files and confirm they exist.
Since the files already make up a bootable system with the customized scripts, we just need to create a bootable CD image, using these files with the mkisofs command.
mkisofs l J R r T o ../ESXi4U1_Unattended.iso b isolinux.cfg c boot.cat no-emul-boot boot-load-size 4 boot-info-table .
NOTE: The command listed above is a SINGLE LINE. Also, notice the . at the end. In Debian based Linux distributions, such as Ubuntu, you will use the genisoimage command.
Pg 27 of 29
www.dailyhypervisor.com/
Now that 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
Pg 28 of 29
www.dailyhypervisor.com/
David Convery
David has been working as a VAC VCP for several years. During that time, he has participated in many planning, design and implementation engagements. Previous to that, he worked at a major disaster recovery services company, where he assisted in recoveries during disasters such as 9/11, and hurricanes Katrina and Rita. He has worked in technology since 1998. David is currently a VMware Certified Design Expert in VI3 and VMware Certified Professional in VI2, VI3 and vSphere 4. He was also awarded the VMware vExpert designation for 2009. David also holds several certifications from HP, Cisco, RedHat, Citrix, Brocade and Symantec.
The Daily Hypervisor is a blog site founded by Sid Smith and Dave Convery dedicated to discussions regarding Virtualization and related technologies. As consultants focused on Virtualization technologies, we have valuable real world experience and knowledge that we would like to share with the community.
Creating an Automated ESXi Installer by David Convery is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Pg 29 of 29
www.dailyhypervisor.com/