1 2 3 Previous Next 206 Replies Latest reply on Apr 8, 2009 1:11 AM by henketh

    Scripted Installations Thread

    Michelle Laverick Virtuoso

      It's occoured to me that currently peoples "kickstart" questions & answers are dotted all over the place on various other threads/blogs. Beyond that there seems to be innumberable resources online especially on redhat.com.

       

      Most of my work with kickstart has been with the UDA, although I have done some work building custom ESX CDs, and at some stage I must return to the topic of putting ESX on a memory stick - which has worked for others, but I've never made work personally.

       

      I wondered if it would be useful to have like a "master" kickstart thread were people post their findings or questions in one place. Perhaps like a sticky FAQ?

       

      Regards

      Mike

        • 1. Re: Scripted Installations Thread
          virtech Master

          Sounds like a good idea to me

          • 2. Re: Scripted Installations Thread
            Michelle Laverick Virtuoso

            OK, well lets seed this thread...

             

            Every day I plan to add a new reply to this message... here's my first...

             

            How would I enable a message to be sent at the end of kickstart install to tell me that it has finished...?[/b]

             

            1. enable the Windows Messenger Service on your management station

             

            add this to the end of the kickstart post at runs when the esx host first boots:

             

            cp /etc/hosts /etc/hosts.bak

            echo 192.168.3.198 mf1 >> /etc/hosts

            esxcfg-firewall -e smbClient

            echo ESX Host: esx4.vi3book.com has completed the build process > /tmp/msg.txt

            smbclient -I 192.168.3.198 -M mf1 < /tmp/msg.txt

            esxcfg-firewall -d smbClient

            rm /tmp/msg.txt -f -r

            mv -f /etc/hosts.bak /etc/hosts

            /code

             

            where 192.168.3.198 is the destination, and MF1 is the netBIO name of Windows XP Professional/W2K3 TS Server... in my case my citrix box...

             

            Regards

            Mike

             

            Message was edited by:

                    Mike_Laverick

            • 3. Re: Scripted Installations Thread
              virtech Master

              Hey thats cool, going to try that.

               

              I have a question:

               

              How do I script an installation to leave a VMFS-2 partition intact and upgrade it to VMFS-3 ?[/b]

              • 4. Re: Scripted Installations Thread
                virtech Master

                Mike do you know if its possible to send email based notifications alerts out?

                 

                I'm guessing there is no smtp mail client installed on the ESX3 server ?

                • 5. Re: Scripted Installations Thread
                  Michelle Laverick Virtuoso

                  How do I script an installation to leave a VMFS-2

                  partition intact and upgrade it to VMFS-3 ?[/b]

                   

                  Not tested:

                   

                  First you would need an upgrade script - like this:

                   

                  \# Auto-Generated Scripted Install Configuration file.

                  \# This file is used for VMware ESX Server Scripted Install Deployment

                   

                  \# Regional Settings

                  keyboard us

                  lang en_US

                  langsupport --default en_US

                  timezone  America/New_York

                   

                  \# Installation Method

                  url --url http://192.168.3.150/esx/esx301/

                   

                  \# root Password

                  \# Authconfig

                   

                  \# BootLoader ( The user has to use grub by default )

                  bootloader --location=mbr --driveorder=cciss/c0d0

                   

                  \# Timezone

                  \# X windowing System

                  skipx

                   

                  \# Install or Upgrade

                  upgrade

                   

                  \# Text Mode

                  text

                   

                  \# Network install type

                  \# Language

                  \# Langauge Support

                  \# Keyboard

                  \# Mouse

                  mouse none

                   

                  \# Reboot after install ?

                  reboot

                   

                  \# Firewall settings

                  firewall --disabled

                   

                  \# Clear Partitions

                  \# Partitioning

                  \# VMware Specific Commands

                  vmaccepteula

                   

                  %packages

                  @base

                   

                  %post

                   

                  %vmlicense_text

                  /code

                   

                  Then underneath %post we have we would script the unloading of the vmfs2/3 drivers, and a load of the auxilary driver in upgrade mode. We would use vmkfstools to do the upgrade - and then load the drivers up. Incidentally, I would find this very scarey - but I guess if its a local VMFS volume you have less worries...

                   

                  \# Your postinstall script goes here!

                  cat > /tmp/esxcfg.sh <<EOF1
                  #!/bin/sh
                  \# Configure ESX Server

                  \# Converting VMFS2 to VMFS3
                  vmkload_mod -u vmfs2
                  vmkload_mod -u vmfs3
                  vmkload_mod fsaux fsauxFunction=upgrade
                  vmkfstools -T /vmfs/volumes/local -x zeroedthick < answeryes.txt
                  vmkload_mod -u fsaux
                  vmkload_mod vmfs2
                  vmkload_mod vmfs3
                  EOF1

                  \# Make esxcfg.sh eXcutable
                  chmod +x /tmp/esxcfg.sh

                  \# Backup original rc.local file
                  cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak

                  \# Make esxcfg.sh run from rc.local and make rc.local reset itself
                  cat >> /etc/rc.d/rc.local <<EOF

                  cd /tmp

                  /tmp/esxcfg.sh

                  mv -f /etc/rc.d/rc.local.bak /etc/rc.d/rc.local

                  EOF

                  /code

                   

                  Regards

                  Mike

                   

                  Message was edited by:

                          Forum poster here is being really wierd - should not be <> but just < but when I got to edit the > away - it doesn't show! Jive software!

                   

                  null

                  • 6. Re: Scripted Installations Thread
                    Michelle Laverick Virtuoso

                    I'm guessing there is no smtp mail client installed

                    on the ESX3 server ?

                     

                    Well, if not perhaps we could install from the network an command-line smtp tool... install it silently with rpm... open smpt/tcp 25 - send the message... uninstall the RPM, close of the ports...

                     

                    Anyone want to take a look at doing this...?

                     

                    Regards

                    Mike

                    • 8. Re: Scripted Installations Thread
                      Michelle Laverick Virtuoso

                      I use the UDA to do my deployments which acts as the central source for my hardware agent software and patches...

                       

                      This is the kickstart script I use to install the HP SIM

                       

                      service portmap start && service nfs start

                      esxcfg-firewall -e nfsClient

                      mkdir /tmp/udasource

                      mount 192.168.3.150:/var/public/smbmount/DISK2 /tmp/udasource

                       

                       

                       

                      \# Copy down the HP SIM to /tmp

                      \# Execute the Installer

                      mkdir /tmp/hpmgmt/770 -p

                      cp /tmp/udasource/hpmgmt/770/* /tmp/hpmgmt/770

                      cd /tmp/hpmgmt/770

                      ./installvm770.sh –silent –inputfile hpmgmt.conf

                       

                      \# Clean up after using NFS on the UDA

                      \# Unmount udasource, remove mounting point, stop services, close firewall

                      umount /tmp/udasource

                      rmdir /tmp/udasource

                      service nfs stop && service portmap stop

                      esxcfg-firewall -d nfsClient

                      /code

                       

                      Regards

                      Mike

                       

                      Message was edited by:

                              Mike_Laverick - removed the dangerous rm -f -r with a rmdir...

                      • 9. Re: Scripted Installations Thread
                        Michelle Laverick Virtuoso

                        Q. How do I create a local VMFS volume as part of a scripted installation:[/b]

                        A. Firstly, you need to create the VMFS partition using the part option in the kickstart file like so

                         

                        clearpart –all –drives=cciss/c0d0 –initlabel

                        part /boot –fstype ext3  –size 250  –ondisk=cciss/c0d0

                        part swap   –size 1600  –ondisk=cciss/c0d0

                        part / –fstype ext3  –size 5120  –ondisk=cciss/c0d0

                        part /var –fstype ext3  –size 2048  –ondisk=cciss/c0d0

                        part /tmp –fstype ext3  –size 2048  –ondisk=cciss/c0d0

                        part /opt –fstype ext3  –size 2048  –ondisk=cciss/c0d0

                        part /home –fstype ext3  –size 2048  –ondisk=cciss/c0d0

                        part None –fstype vmkcore  –size 100  –ondisk=cciss/c0d0

                        part None –fstype vmfs3 –size 1 –grow –ondisk=cciss/c0d0

                        /code

                         

                        Note:

                        /vmfs is required in kickstart to be successful. Grow indicates the vmfs partition should use the remainder of the disk. Despite being the last partition mentioned, the anaconda script actually makes the vmkcore the 10th partition with the VMFS being the 9th partition... Anaconda appear to only create the VMFS partition - its doesn't format the partition...

                         

                        So in the post script section use vmkfstools for format the partition

                         

                        vmkfstools -C vmfs3 -S esx4-localstorage vmhba0:0:0:9

                         

                        If you are unsure of the what the vmhba syntax should be - use esxcfg-vmhbadevs to find the Linux /dev/ identity to the volume - and fdisk /dev/sda or whatever to find out the partition number - look for the fb type is the hex which indicates a VMFS volume...

                         

                        Regards

                        Mike

                         

                        Message was edited by:

                                Mike_Laverick

                         

                        Corrected a slight mistake - should be None for the "mount point" not /vmfs as I had earlier...

                        • 10. Re: Scripted Installations Thread
                          Michelle Laverick Virtuoso

                          Q. How do I change the NIC assigned to the Service Console?[/b]A. In the %post script section use something like this:

                           

                          esxcfg-vswitch -U vmnic0 vSwitch0

                          esxcfg-vswitch -L vmnic5 vSwitch0

                          /code

                           

                          Regards

                          Mike

                          • 11. Re: Scripted Installations Thread
                            wila Guru
                            vExpertUser ModeratorsCommunity Warriors

                            If you can use perl, then you could use this script:

                            http://www.vmware.com/community/click.jspa?searchID=3062532&messageID=536286

                            | Author of Vimalin. The virtual machine Backup app for VMware Desktop Products
                            | Vimalin : Automated backups for VMware Fusion and VMware Workstation Professional
                            | More info at https://www.vimalin.com
                            | Twitter @wilva
                            | VMware Wiki at http://www.vi-toolkit.com
                            • 12. Re: Scripted Installations Thread
                              Michelle Laverick Virtuoso

                              Q. I have put esxcfg- commands in the %post section - but they don't seem to run - Why?[/b]

                               

                              A. The %post section is run by anaconda immediately after the file copy process ends. At this stage a linux kernel is loaded. The esxcfg commands are vmkernel commands, and as such the vmkernel must be loaded for them to work. To deal with this situation it is common to create/modify a script that runs on first-boot. If your a windows guy, you could see it as tagging a referrence to the end of autoexec.bat or putting a script in the start-up directory. There two ways of getting this script to execute. One is to create a start-up script s101post-config for example - or to modify rc.local (the last script to be executed in the boot process). My personal preference is for rc.local.

                               

                              This is pretty much "standard" template for making esxcfg- commands work

                               

                              \# Your postinstall script goes here!

                              cat > /tmp/esxcfg.sh <<EOF1
                              #!/bin/sh
                              \# Configure ESX Server

                              PUT YOUR ESXCFG commands & other here....

                              EOF1

                              \# Make esxcfg.sh eXcutable
                              chmod +x /tmp/esxcfg.sh

                              \# Backup original rc.local file
                              cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak

                              \# Make esxcfg.sh run from rc.local and make rc.local reset itself
                              cat >> /etc/rc.d/rc.local <<EOF

                              cd /tmp

                              /tmp/esxcfg.sh

                              mv -f /etc/rc.d/rc.local.bak /etc/rc.d/rc.local

                              EOF

                              /code

                               

                              This creates a script file called esxcfg.sh... which is then called by rc.local. Once esxcfg.sh has been execute, rc.local is reset to make sure the script doesn't run again at the next boot...

                               

                              Regards

                              Mike

                               

                              Message was edited by:

                                      Mike_Laverick

                              • 13. Re: Scripted Installations Thread
                                gogogo5 Expert

                                This is a useful PDF explaining how Linux enumerates NICs during device discovery.  I found this useful in understanduing why, during my scripted install, the SC NIC didnt bind to vmnic0, which was the first onboard NIC I wanted to assign.

                                 

                                http://linux.dell.com/files/whitepapers/nic-enum-whitepaper-v3.pdf

                                • 14. Re: Scripted Installations Thread
                                  virtech Master

                                  Does anyone know if you can use a AD group to authenticate with in ESX3 ?   Normally you have to create a user on the ESX3 server that matches a user in AD.

                                  1 2 3 Previous Next