Saturday, March 10, 2007

Unattended install of ESX with Microsoft's RIS-server

I needed to install a lot of ESX servers and thought of a little automation.So I looked around the web and found this link : http://www.vmware.com/community/message.jspa?messageID=466174

In short it comes to this :

Setup the RIS Server :

  1. Install DHCP and RIS
  2. On your RIS server create the following folder structure: Setup\English\Images\PXELinux\i386\templates\pxelinux.cfg\ (pxelinux.cfg is a folder)
  3. Download the latest version of syslinux from: http://www.kernel.org/pub/linux/utils/boot/syslinux/
  4. From the ESX 3 (this works with 2.5.x as well) CD (images\pxeboot) copy the following files to Setup\English\Images\PXELinux\i386\templates vmlinuz initrd.img

    NOTE: you MAY want to rename these files IF you plan on have multiple versions of ESX builds available.
  5. From the file you downloaded in step 2, copy the pxelinux.0 to the templates folder.
  6. Create a file called pxelinux.sif file in the template folder with the following contents: [OSChooser]
    Description = "Linux"
    Help = "This option runs a Linux installer."
    LaunchFile = "Setup\English\Images\PXELinux\i386\templates\pxelinux.0"
    ImageType = Flat Version="1.01"
  7. In the Setup\English\Images\PXELinux\i386\templates\pxelinux.cfg folder create a file called 'default' (no extension) with the following info.
    DEFAULT esx
    prompt 1
    display boot.msg
    timeout 1000
    label esx
    kernel vmlinuz append initrd=initrd.img
  8. Install NFS on your RIS server, Windows 2003 R2 provides it as a standard component
  9. Create an NFS share with a copy of the Vmware ESX 3.0.1 CD.
  10. Enable scripted installation feature on an already installed ESX to create the answer files.
    You can use this link page 94 : http://www.vmware.com/pdf/vi3_installation_guide.pdf
  11. Log in to the ESX Server 3.0.1 service console as root.
  12. Open the file/usr/lib/vmware/webAccess/tomcat/apache-tomcat-5.5.17/webapps/ui/WEB-INF/struts-config.xml in a text editor such as vi.
  13. Locate the scripted section.
  14. Comment out the line reading:
  15. Uncomment the following lines:
  16. Save and close the file.
  17. Type service vmware-webAccess restart.
  18. Launch a supported Web browser and enter the URL of your ESX Server installation to open VI Web Access.The Welcome page appears.
  19. Click Log in to the Scripted Installer.
  20. Follow the onscreen instructions to create and download the answer file
  21. Save the answer file in the root of your NFS share.
  22. Boot your new physical server, let it boot from PXE
  23. At the boot: type esx and the link to the answer file you want to use during install, for example : esx ks=nfs:192.168.29.45:/PXEInstallESX/KS.cfg

TIP : If you have the MAC-addresses of your servers up-front (some hardware vendors can provide this info together with the serial number of the server), you can create additionale files in the Setup\English\Images\PXELinux\i386\templates\pxelinux.cfg directory. Name them after MAC-addresses of your servers.
DEFAULT esx
prompt 1
display boot.msg
timeout 1000
label esx
kernel vmlinuz
append initrd=initrd.img ks=nfs:192.168.29.45:/PXEInstallESX/KS.cfg

This way everything would be fully automated.

Have fun with it ...

4 comments:

JonEm said...

Thanks - instructions are clear and I followed them to the letter but I'm having a few problems.

After running the esx blahblah command from the prompt, the ESX loader appears to kick off but then just stops after a load of text has been displayed on the screen.
If I try to type anything into the console, I get the following message:

VFS: Cannot open root device "" or 02:00
Please append a correct "root=" boot option
Kernel panic: VFS:Unable to mount root fs on 02:00

JonEm said...

Ah, found the problem. As I said, followed the guide to the letter and there's a bit of a formatting error on this line:

kernel vmlinuz append initrd=initrd.img

It should be separated as:

kernel vmlinuz
append initrd=initrd.img

JonEm said...

More feedback!

After the text installer kicks off, it starts prompting me for input about the locale, keyboard, where the ESX image is (FTP, NFS, CD, HTTP, etc) and then I have to enter the details of the NFS server.

I expected this to be automated - how come it's not? Something wrong?

Koen Warson said...

Hi,

Did you create an NFS share with the installation files as well ?
I allways use NFS but you can also use FTP or HTTP.

or you can specify the installation path at boot prompt or you can add them in the "default"-boot file.

LABEL esx --new line--
kernel vmlinuz --new line--
append initrd=initrd.img ks=nfs:192.168.1.12:/PXEInstallESX/server1.cfg ksdevice=eth0 --new line--

Most of the time when annaconda-setup asks for keyboard/mouse/ installation files location means that it cann't connect to the .cfg file on the NFS/FTP or HTTP server.