Scripted installation is a new feature for ESXi which is introduced with the release of vSphere 4.1. In this article I’m describing the setup of my home lab in which I use this new feature. Please be advised that this article assumes some basic understanding of Windows and ESX and gives you some guidelines which you can alter for your own specific needs.
There are a few ingredients we need to get this ESXi Scripted Installation to work:
- ESXi Source Repository (HTTP in this article)
- PXELinux
- TFTP Server
- DHCP Server
ESXi Source Repository
1. Install IIS on the Windows Server that will be serving the HTTP repository.
2. Create a ESXi directory in the wwwroot (for example d:\Inetpub\wwwroot\ESXi)
3. Copy all the files from the ESXi ISO to the \ESXi folder (do not copy the .ISO itself but only the files in the .ISO)
4. Start the IIS Manager (Start, All Programs, Administrative Tools, Internet Information Services IIS Manager
5. Right-click the “Default Website” and select “Properties”
6. Click on the “HTTP Headers”-tab and select “MIME Types”
7. Click “New” and Add:
- Extension: *
- MIME Type: All
8. Now Click OK, OK, OK and exit the IIS Manager
PXELinux
1. Create a PXEboot directory (e.g. d:\PXEboot)
2. Create a subdirectory called ESXi (e.g. d:\PXEboot\ESXi)
3. Download and place pxelinux.0 in the d:\PXEboot
4. Copy the 8 files listed below from the ESXi ISO to the d:\PXEboot directory
- cim.vgz
- ienviron.vgz
- install.vgz
- mboot.c32
- menu.c32
- sys.vgz
- vmkboot.gz
- vmkernel.gz
5. Create the directory d:\PXEboot\pxelinux.cfg
6. Copy the isolinux.cfg from the ESXi ISO to d:\PXEboot\pxelinux.cfg (please note that this is a directory)
7. Open the d:\PXEboot\pxelinux.cfg\isolinux.cfg with Notepad++ or VIM (or any other tool that doesn’t cause the line feed/carriage return problem with Linux files) and make the following adjustments:
- Add the IIS directory name in front of all 8 file references (so in this case “ESXi/”)
- Add “ks=http://x.x.x.x/ESXi/ks.cfg” (if you want an interactive installation, skip this line)
- Additionally more bootstrap commands can be added as part of the “ks=…” line, see the ESXi Installable and vCenter Server Setup Guide (page 41)
8. Save the file
9. Rename the file to default (make sure it has got no file extension)
Alternately you can also use the following naming convention which is described in the ESXi Installable and vCenter Server Setup Guide (page 33)
Filename for the PXE Configuration File
For the filename of the PXE configuration file, choose one of the following:
– 01-mac_address_of_target_ESXi_host. For example, 01-23-45-67-89-0a-bc
– The target ESXi host IP address in hexadecimal notation.
– defaultThe initial boot file, pxelinux.0 (or gpxelinux.0) tries to load a PXE configuration file. It tries with the MAC address of the target ESXi host, prefixed with its ARP type code (01 for Ethernet). If that fails, it tries with the hexadecimal notation of target ESXi system IP address. Ultimately, it tries to load a file named default.
10. Create the d:\Inetpub\wwwroot\ESXi\ks.cfg file (this is the Kickstart Script which contains the installation details)
11. Open the ks.cfg with with Notepad++ or VIM and add the following lines to it (which need to be altered for your specific needs):
All the available options can be found in the ESXi Installable and vCenter Server Setup Guide (page 41)
TFTP Server
Now it’s time to get the TFTP Server running. You can use your favorite TFTP program or follow the instructions on this site
DHCP Server
The last step is to get the DHCP server installed and configured. In my home environment I’ve got an Internet Router which acts as DHCP server for my internal network. Since I prefer to use this DHCP server which isn’t capable of DHCP Options I decided to create a secondary DHCP server based on a Windows 2003 Server which is capable of DHCP options.
Please see the overview below to get an understanding of my setup.
I connected this secondary DHCP server to an isolated network within VMware Workstation (vmnet2). Consequently this means that whenever I want to deploy an ESXi Host I first need to attach it to vmnet2 and after deployment I need to change it to the bridged network.
1. Install the DHCP Service.
2. Create a DHCP Scope and active it.
3. Right-click Scope Options and select “Configure Options”
4. Scroll down the Available Options and configure
- 066 Boot Server Host Name with your DHCP Server IP address
- 067 Bootfile Name with pxelinux.0 (we placed this file earlier on in the d:\PXEboot directory)
Test the Scripted Installation
It’s now time to test the scripted environment by starting your Target ESXi Host, if PXE works it will show the screen below where it will start downloading the source files.
Current Scripted Installation Limitations
Please note the current limitations of Scripted Installations:
As outlined in this VMware KB article.
Sander Daems
/ July 21, 2010Very nice article! Will try this setup in my test lab 🙂
Simon Long
/ July 21, 2010Nice post Kenneth. If you wanted to you could use the same Virtual Appliance that I use to deploy ESXi, it has DHCP, TFTP and PXE all on the same app.
Check it out here: http://www.simonlong.co.uk/blog/2010/02/23/a-simple-vmware-esxi-rapid-deployment-system-part-1/
Simon
Kenneth van Ditmarsch
/ July 21, 2010Thanks for the link dude 🙂
Brian
/ July 21, 2010Great post, was going to be trying this myself soon.
Bouke Groenescheij
/ July 21, 2010WAUW!!!! Excellent post – thank you very much!
Diego Quintana
/ July 21, 2010Excellent Post and very useful.
Kendrick Coleman
/ July 21, 2010great walkthrough and I almost have it working. I’m trying to do this all on Windows Server 2008 R2 and not server 2003.
Windows Server 2008 R2 will not allow you to create the * All mime type. It asks for a / tag.
“5. Create the directory d:\PXEboot\pxelinux.cfg”. I can create a new folder called pxelinux.cfg, but I don’t know how I can “7. Open the d:\PXEboot\pxelinux.cfg with Notepad++” because I can’t open a folder with Notepad++.
As for the TFTP server setup, you should probably note that the TFTP server should be pointed at the directory D:\PXEboot\pxelinux.cfg
At this moment, I’m failing. I’m getting “Trying to load: pxelinx.cfg/default and unable to locate configuration file.
going to try and continue working on it to see what comes of it.
Kendrick Coleman
/ July 21, 2010ok nevermind. i got it all working. Here is where I messed up:
4. Copy the 8 files listed below from the ESXi ISO to the d:\PXEboot directory
All of these files should be placed in the ESXi folder inside the PXEboot directory.
the TFTP server should be pointing to D:\PXEboot
Also, if you’re on Windows Server 2008, in the features view of IIS, don’t forget to Enable the Directory Browsing service.
Kenneth van Ditmarsch
/ July 21, 2010Hi Kendrick,
Does it work with Windows 2008 when you add a MIME type: ‘application/octet-stream’ (with the quotes)?
Secondly, you are totally right, step 7 needs to be: 7. Open the d:\PXEboot\pxelinux.cfg\isolinux.cfg (I’ve corrected this in the post, thanks for pointing that out)
Concerning the tftp, yeah this needs to be pointed to the tftp directory (in this example d:\pxeboot)
Kenneth
Kenneth van Ditmarsch
/ July 21, 2010Please note Kendrick’s note: Also, if you’re on Windows Server 2008, in the features view of IIS, don’t forget to Enable the Directory Browsing service.
Since this isn’t the case on Windows 2003
Kendrick Coleman
/ July 21, 2010ok last one i swear.
i figured out the mime type for 2008 R2
Click your ESXi site under default Web Site
Under Feature View, right click MIME Types and Open Feature
Add:
File name extension: .cfg
MIME Type: text/plain
Eric van der Meer
/ July 22, 2010Thanks for sharing this tutorial with us Kenneth!
Dennis Agterberg
/ July 22, 2010Nice article Kenneth. I can remove this one (no automatic deployment) from the list of ESXi disadvantages for the environment I’m currently working on.
Eric
/ July 22, 2010Nice article. Any chance you’ll be adding any examples for using the %pre, %post and %firstboot sections of the ks.cfg file? A lot of people leveraged %pre and %post pretty heavily for scripted ESX installations. I’m looking to port my ks.cfg into a new one for ESXi 4.1.
Justin
/ August 4, 2010No worky on ESXi 4.1
Try to install to USB on my PowerEdge T710 and it gets around 50% and fails saying there must be bad sectors. Tried with a brand new USB stick and same thing. Downloading the Dell customized image and see if that changes anything.
MigrationKing
/ August 20, 2010Nice Article. Do you have a tutorial (or can you create one) for Apache (on Linux), TFTP, DHCP on Linux?
Kenneth van Ditmarsch
/ August 20, 2010Hi,
No I haven’t got a tutorial on the Linux stuff. Basically the most important message in this article is setting up the ESXi part and not specifically the TFTP and DHCP stuff.
Kenneth
Eric Sarakaitis
/ September 28, 2010here is a way to configure your PXE environment using linux for tftp…
http://www.vmwareadmins.com/index.php/articles/92-automated-esx-host-builds-using-pxe.html
vRico
/ October 6, 2010Great work Kenneth! I believe the USB problem stated earlier might be a know issue: http://www.vmware.com/support/vsphere4/doc/vsp_41_new_feat.html (scripted install to USB is not supported).
Also, is there a way to do this to a diskless “state-less” scripted installation? I could piece the 2 methods together (script install a host, then port over the binaries and boot to PXE stateless after the fact.. rinse & repeat) but it has a manual element to is. I am doing testing on both PXE script install and PXE boot diskless and wondered what your thoughts were on combining them. I will keep you updated to any useful results.
Kenneth van Ditmarsch
/ October 6, 2010Hi Rico,
Thanks. First of all, yeah there is definitely a way to do a stateless install of ESX (in which ESX is only running from memory).
Please take a look at this appliance that is capable of doing that and is capable of automatically add the deployed, stateless, ESXi host to the vCenter inventory
http://labs.vmware.com/flings/vmware-auto-deploy
Good luck!
Kenneth
Christian Mohn
/ November 8, 2010For IIS6.1 (Windows Server 2008 R2), the mime extension above doesn’t work. Add * as application/octet-stream instead.
Anders Hansen
/ August 4, 2011Very good post. A sidenote, you have to use the same version of pxelinux as the isolinux-version of esxi4.1u1 is using. Currently ver 3.63. I started out with version 4.04 and that did not work.
Ronan
/ September 30, 2011Hi,
is there a way I can include a 8mb block size for pre-presented SAN storage in the kickstart file? All the storage presentation are all ready in place on the enclosure so when the esx builds occur i want them to already have the mac block size set.
Thanks
Ro,
techstarts
/ October 1, 2011Check out how you can do for ESXi 5.0 now at vcp5.wordpress.com. Thanks your article inspired me to do one for ESXi5.0. Comments welcomed
Kenneth van Ditmarsch
/ October 24, 2011Yes there is: http://www.yellow-bricks.com/2009/11/11/changing-the-block-size-of-your-local-vmfs-during-the-install/