WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Uncategorized / Automating ESXi 5.1 Kickstart Tips & Tricks

Automating ESXi 5.1 Kickstart Tips & Tricks

09.17.2012 by William Lam // 38 Comments

There is not a whole lot of changes for kickstart configurations between ESXi 5.1 and ESXi 5.0, majority of the tips and tricks noted in the ESXi 5.0 kickstart guide are still relevant for ESXi 5.1. Below are a few new tips and tricks (some old) as well as a complete working ESXi 5.1 kickstart example that can be used as a reference.

Tip #1

There are 82 new ESXCLI commands, number of which are new as well as enhancements to existing commands and operations. The kickstart sample below converts many of the legacy esxcfg-* and vim-cmd/vsish commands over to ESXCLI such as, here are just a few:

  • esxcli network ip route [ipv4|ipv6] (VMkernel routes)
  • esxcli system snmp (SNMP)
  • esxcli system maintenanceMode (maintenance mode)
  • esxcli network ip interface tag (tag VMkernel traffic types)

Please refer to the vCLI/ESXCLI release notes for all new ESXCLI commands.

Tip #2

In previous releases of ESXi, you could add custom commands in /etc/rc.local which will automatically execute after all startup scripts have finished. With the latest release of ESXi 5.1, this functionality has been moved to /etc/rc.local.d/local.sh. If you try to edit the old file, you will find that it does not allow you to write any changes. This will be important as you migrate to ESXi 5.1 kickstart if you make use of this file for any custom startup commands.

Tip #3

To run nested ESXi and other hypervisors in ESXi 5.1, you need to to specify new vhv.enable parameter, please take a look at this article for more details.

Tip #4

There is a new ESXi Advanced Setting in ESXi 5.1 that allows you to control when an interactive ESXi Shell session will automatically logout based on configured idle time (in seconds). You can find more details in this blog article by Kyle Gleed.

esxcli system settings advanced set -o /UserVars/ESXiShellInteractiveTimeOut -i 3600

Tip #5

By default, an ESXi host will automatically grant root permission to the "ESX Admins" group for use when a host is joined to an Active Directory domain. You can alter the default group name if you already have an AD group defined by using the following command:

vim-cmd hostsvc/advopt/update Config.HostAgent.plugins.hostsvc.esxAdminsGroup string "Ghetto ESXi Admins"

Tip #6

A really neat feature in ESXi 5.1 is the ability to control which local users have full admin privileges to the DCUI, this is really useful for troubleshooting and you want to provide DCUI console access but not administrative permissions on the ESXi host itself. You can specify a list of local users by using the following command:

vim-cmd hostsvc/advopt/update DCUI.Access string root,william,tuan

Tip #7

If you wish to prevent VMs from sending out BPDU (Bridge Protocol Data Unit) packets, there is a new global configuration on an ESXi 5.1 host which you can set. By default, this setting is disabled and you will need to configure this on every ESXi host if you wish to block VM guests from sending out BPDU packets.

esxcli system settings advanced set -o /Net/BlockGuestBPDU -i 1

Tip #8

Here's an article about enabling/disabling IPv6 using ESXCLI

Tip #9

Here's an article about creating custom VIB for ESXi 5.1

Here is a complete working example of an ESXi 5.1 kickstart that can help you convert your existing ESX(i) 4.x/5.x to ESXi 5.1:

# Sample kickstart for ESXi 5.1
# William Lam
# www.virtuallyghetto.com
#########################################
 
accepteula
install --firstdisk --overwritevmfs
rootpw vmware123
reboot
 
%include /tmp/networkconfig
 
%pre --interpreter=busybox
 
# extract network info from bootup
VMK_INT="vmk0"
VMK_LINE=$(localcli network ip interface ipv4 get | grep "${VMK_INT}")
IPADDR=$(echo "${VMK_LINE}" | awk '{print $2}')
NETMASK=$(echo "${VMK_LINE}" | awk '{print $3}')
GATEWAY=$(localcli network ip route ipv4 list | grep default | awk '{print $3}')
DNS="172.30.0.100,172.30.0.200"
HOSTNAME=$(nslookup "${IPADDR}" "${DNS}" | grep Address | grep "${IPADDR}" | awk '{print $4}')
 
echo "network --bootproto=static --addvmportgroup=false --device=vmnic0 --ip=${IPADDR} --netmask=${NETMASK} --gateway=${GATEWAY} --nameserver=${DNS} --hostname=${HOSTNAME}" > /tmp/networkconfig
 
%firstboot --interpreter=busybox
 
# enable VHV (Virtual Hardware Virtualization to run nested 64bit Guests + Hyper-V VM)
grep -i "vhv.enable" /etc/vmware/config || echo "vhv.enable = \"TRUE\"" >> /etc/vmware/config
 
# enable & start remote ESXi Shell  (SSH)
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
 
# enable & start ESXi Shell (TSM)
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell
 
# supress ESXi Shell shell warning - Thanks to Duncan (http://www.yellow-bricks.com/2011/07/21/esxi-5-suppressing-the-localremote-shell-warning/)
esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1
 
# ESXi Shell interactive idle time logout
esxcli system settings advanced set -o /UserVars/ESXiShellInteractiveTimeOut -i 3600
 
# Change the default ESXi Admins group "ESX Admins" to a custom one "Ghetto ESXI Admins" for AD
vim-cmd hostsvc/advopt/update Config.HostAgent.plugins.hostsvc.esxAdminsGroup string "Ghetto ESXi Admins"
 
# Users that will have full access to DCUI even if they don't have admin permssions on ESXi host
vim-cmd hostsvc/advopt/update DCUI.Access string root,william,tuan
 
# Block VM guest BPDU packets, global configuration
esxcli system settings advanced set -o /Net/BlockGuestBPDU -i 1
 
# copy SSH authorized keys & overwrite existing
wget http://air.primp-industries.com/esxi5/id_dsa.pub -O /etc/ssh/keys-root/authorized_keys
 
# disable SSH keys - uncomment the next section
# sed -i 's/AuthorizedKeysFile*/#AuthorizedKeysFile/g' /etc/ssh/sshd_config
 
# rename local datastore to something more meaningful
vim-cmd hostsvc/datastore/rename datastore1 "$(hostname -s)-local-storage-1"
 
# assign license
vim-cmd vimsvc/license --set AAAAA-BBBBB-CCCCC-DDDDD-EEEEE
 
## SATP CONFIGURATIONS ##
esxcli storage nmp satp set --satp VMW_SATP_SYMM --default-psp VMW_PSP_RR
esxcli storage nmp satp set --satp VMW_SATP_DEFAULT_AA --default-psp VMW_PSP_RR
 
###########################
## vSwitch configuration ##
###########################
 
#####################################################
# vSwitch0 : Active->vmnic0,vmnic1 Standby->vmnic2
#       failback: yes
#       faildectection: beacon
#       load balancing: portid
#       notify switches: yes
#       avg bw: 1000000 Kbps
#       peak bw: 1000000 Kbps
#       burst size: 819200 KBps
#       allow forged transmits: yes
#       allow mac change: no
#       allow promiscuous no
#       cdp status: both
 
# attach vmnic1,vmnic2 to vSwitch0
esxcli network vswitch standard uplink add --uplink-name vmnic1 --vswitch-name vSwitch0
esxcli network vswitch standard uplink add --uplink-name vmnic2 --vswitch-name vSwitch0
 
# configure portgroup
esxcli network vswitch standard portgroup add --portgroup-name VMNetwork1 --vswitch-name vSwitch0
esxcli network vswitch standard portgroup set --portgroup-name VMNetwork1 --vlan-id 100
esxcli network vswitch standard portgroup add --portgroup-name VMNetwork2 --vswitch-name vSwitch0
esxcli network vswitch standard portgroup set --portgroup-name VMNetwork2 --vlan-id 200
esxcli network vswitch standard portgroup add --portgroup-name VMNetwork3 --vswitch-name vSwitch0
esxcli network vswitch standard portgroup set --portgroup-name VMNetwork3 --vlan-id 333
 
# configure cdp
esxcli network vswitch standard set --cdp-status both --vswitch-name vSwitch1
 
### FAILOVER CONFIGURATIONS ###
 
# configure active and standby uplinks for vSwitch0
esxcli network vswitch standard policy failover set --active-uplinks vmnic0,vmnic1 --standby-uplinks vmnic2 --vswitch-name vSwitch0
 
# configure failure detection + load balancing (could have appended to previous line)
esxcli network vswitch standard policy failover set --failback yes --failure-detection beacon --load-balancing portid --notify-switches yes --vswitch-name vSwitch0
 
### SECURITY CONFIGURATION ###
esxcli network vswitch standard policy security set --allow-forged-transmits yes --allow-mac-change no --allow-promiscuous no --vswitch-name vSwitch0
 
### SHAPING CONFIGURATION ###
esxcli network vswitch standard policy shaping set --enabled yes --avg-bandwidth 100000 --peak-bandwidth 100000 --burst-size 819200 --vswitch-name vSwitch0
 
#####################################################
# vSwitch1 : Active->vmnic3,vmnic4 Standby->vmnic5
#       failback: no
#       faildectection: link
#       load balancing: mac
#       notify switches: no
#       allow forged transmits: no
#       allow mac change: no
#       allow promiscuous no
#       cdp status: listen
#       mtu: 9000
 
# add vSwitch1
esxcli network vswitch standard add --ports 256 --vswitch-name vSwitch1
 
# attach vmnic3,4,5 to vSwitch0
esxcli network vswitch standard uplink add --uplink-name vmnic3 --vswitch-name vSwitch1
esxcli network vswitch standard uplink add --uplink-name vmnic4 --vswitch-name vSwitch1
esxcli network vswitch standard uplink add --uplink-name vmnic5 --vswitch-name vSwitch1
 
# configure mtu + cdp
esxcli network vswitch standard set --mtu 9000 --cdp-status listen --vswitch-name vSwitch1
 
# configure portgroup
esxcli network vswitch standard portgroup add --portgroup-name NFS --vswitch-name vSwitch1
esxcli network vswitch standard portgroup add --portgroup-name FT_VMOTION --vswitch-name vSwitch1
esxcli network vswitch standard portgroup add --portgroup-name VSPHERE_REPLICATION --vswitch-name vSwitch1
 
### FAILOVER CONFIGURATIONS ###
 
# configure active and standby uplinks for vSwitch1
esxcli network vswitch standard policy failover set --active-uplinks vmnic3,vmnic4 --standby-uplinks vmnic5 --vswitch-name vSwitch1
 
# configure failure detection + load balancing (could have appended to previous line)
esxcli network vswitch standard policy failover set --failback no --failure-detection link --load-balancing mac --notify-switches no --vswitch-name vSwitch1
 
### SECURITY CONFIGURATION ###
esxcli network vswitch standard policy security set --allow-forged-transmits no --allow-mac-change no --allow-promiscuous no --vswitch-name vSwitch1
 
# configure vmkernel interface for NFS traffic, FT_VMOTION and VSPHERE_REPLICATION traffic
VMK0_IPADDR=$(esxcli network ip interface ipv4 get | grep vmk0 | awk '{print $2}')
VMK1_IPADDR=$(echo ${VMK0_IPADDR} | awk '{print $1".51."$3"."$4}' FS=.)
VMK2_IPADDR=10.10.0.2
VMK3_IPADDR=10.20.0.2
esxcli network ip interface add --interface-name vmk1 --mtu 9000 --portgroup-name NFS
esxcli network ip interface ipv4 set --interface-name vmk1 --ipv4 ${VMK1_IPADDR} --netmask 255.255.255.0 --type static
esxcli network ip interface add --interface-name vmk2 --mtu 9000 --portgroup-name FT_VMOTION
esxcli network ip interface ipv4 set --interface-name vmk2 --ipv4 ${VMK2_IPADDR} --netmask 255.255.255.0 --type static
esxcli network ip interface add --interface-name vmk3 --mtu 9000 --portgroup-name VSPHERE_REPLICATION
esxcli network ip interface ipv4 set --interface-name vmk3 --ipv4 ${VMK3_IPADDR} --netmask 255.255.255.0 --type static
 
# Configure VMkernel traffic type (Management, VMotion, faultToleranceLogging, vSphereReplication)
esxcli network ip interface tag add -i vmk2 -t Management
esxcli network ip interface tag add -i vmk2 -t VMotion
esxcli network ip interface tag add -i vmk2 -t faultToleranceLogging
esxcli network ip interface tag add -i vmk3 -t vSphereReplication
 
# Configure VMkernel routes
esxcli network ip route ipv4 add -n 10.20.183/24 -g 172.30.0.1
esxcli network ip route ipv4 add -n 10.20.182/24 -g 172.30.0.1
 
# Disable IPv6 for VMkernel interfaces
esxcli system module parameters set -m tcpip3 -p ipv6=0
 
### MOUNT NFS DATASTORE ###
esxcli storage nfs add --host 172.51.0.200 --share /volumes/Primp/primp-6 --volume-name himalaya-NFS-primp-6
 
### ADV CONFIGURATIONS ###
esxcli system settings advanced set --option /Net/TcpipHeapSize --int-value 30
esxcli system settings advanced set --option /Net/TcpipHeapMax --int-value 120
esxcli system settings advanced set --option /NFS/HeartbeatMaxFailures --int-value 10
esxcli system settings advanced set --option /NFS/HeartbeatFrequency --int-value 20
esxcli system settings advanced set --option /NFS/HeartbeatTimeout --int-value 10
esxcli system settings advanced set --option /NFS/MaxVolumes --int-value 128
 
### SYSLOG CONFIGURATION ###
esxcli system syslog config set --default-rotate 20 --loghost vcenter50-3.primp-industries.com:514,udp://vcenter50-3.primp-industries.com:514,ssl://vcenter50-3.primp-industries.com:1514,udp://vcenter50-3.primp-industries.com:514,udp://vcenter50-3.primp-industries.com:514,ssl://vcenter50-3.primp-industries.com:1514,ssl://vcenter50-3.primp-industries.com:1514
 
# change the individual syslog rotation count
esxcli system syslog config logger set --id=hostd --rotate=20 --size=2048
esxcli system syslog config logger set --id=vmkernel --rotate=20 --size=2048
esxcli system syslog config logger set --id=fdm --rotate=20
esxcli system syslog config logger set --id=vpxa --rotate=20
 
### NTP CONFIGURATIONS ###
cat > /etc/ntp.conf << __NTP_CONFIG__
restrict default kod nomodify notrap noquery nopeer
restrict 127.0.0.1
server 0.vmware.pool.ntp.org
server 1.vmware.pool.ntp.org
__NTP_CONFIG__
/sbin/chkconfig ntpd on
 
### FIREWALL CONFIGURATION ###
 
# enable firewall
esxcli network firewall set --default-action false --enabled yes
 
# services to enable by default
FIREWALL_SERVICES="syslog sshClient ntpClient updateManager httpClient netdump"
for SERVICE in ${FIREWALL_SERVICES}
do
 esxcli network firewall ruleset set --ruleset-id ${SERVICE} --enabled yes
done
 
# backup ESXi configuration to persist changes
/sbin/auto-backup.sh
 
# enter maintenance mode
esxcli system maintenanceMode set -e true
 
# copy %first boot script logs to persisted datastore
cp /var/log/hostd.log "/vmfs/volumes/$(hostname -s)-local-storage-1/firstboot-hostd.log"
cp /var/log/esxi_install.log "/vmfs/volumes/$(hostname -s)-local-storage-1/firstboot-esxi_install.log"
 
# Needed for configuration changes that could not be performed in esxcli
esxcli system shutdown reboot -d 60 -r "rebooting after host configurations"

More from my site

  • How to clear the ARP cache in ESXi prior to vSphere 5.5
  • 2gbsparse Disk Format No Longer Working On ESXi 5.1
  • A Pretty Cool Method of Upgrading to ESXi 5.1
  • Disabling IPv6 via Command-Line For ESXi 5.1 (Without Automatic Host Reboot)
  • Applying additional security hardening enhancements in ESXi 8.0

Categories // Uncategorized Tags // esxcli, ESXi 5.1, kickstart, ks.cfg, vSphere 5.1

Comments

  1. *protectedRalf says

    10/16/2012 at 3:53 pm

    The line GATEWAY=$(localcli network ip interface ipv4 get | grep "${VMK_INT}" didn't work for me, because it returned the ip of the host and not the gw. I've replaced it with

    GATEWAY=$(localcli network ip route ipv4 list | grep default | awk '{print $3}')

    Reply
    • *protectedWilliam says

      10/18/2012 at 10:17 pm

      @Ralf,

      Thanks, I'll go ahead and update the command.

      Reply
  2. *protectedAnonymous says

    11/14/2012 at 3:40 am

    Just wanted to say thanks. That's alot of work you have done

    Reply
  3. *protectedAnonymous says

    12/06/2012 at 3:38 pm

    I think you don't have to specify "--level 345" to chkconfig.
    I can see in my log:
    /sbin/chkconfig --level 345 ntpd on
    /sbin/chkconfig error: Warning: --level argument is not implemented

    Reply
    • *protectedWilliam says

      12/06/2012 at 4:09 pm

      Thanks, looks like this portion was copied from an earlier KS ๐Ÿ™‚ You just need to set the service to start automatically

      Reply
  4. *protectedMr_Scott says

    12/13/2012 at 10:33 pm

    William,
    Does Tip#6 allow for use of AD accounts, not local?
    Thanks.

    Reply
    • *protectedWilliam says

      12/14/2012 at 9:57 pm

      It's only for local accounts

      Reply
  5. *protectedSean Lv' Blog says

    12/25/2012 at 9:56 am

    thanks a lot for William's great post.

    Is there a default network security settings exists? I mean the settings of Promiscuous/MAC Address Changes/Forged Transmits. So when I create a vswitch, the default settings would be applied to.

    if there is ,how to set it by cli?

    thanks

    Reply
    • *protectedWilliam says

      12/25/2012 at 9:04 pm

      Sean,

      There is a default (create a vSwitch and you'll see what they are) but this is not something you can configure. So you'll still need to set the appropriate security settings based on your requirements.

      Reply
    • *protectedSean Lv' Blog says

      12/26/2012 at 9:06 am

      Hi William

      I see. thank you. I asked the question because both in vSwitch and PortGroup properties, there are "Security" tab and displays "Policy Exception". Generally, the word exception indicates inheritance blocked, so I guess there should be a default settings:) Unfortunately, it can not be configured.

      Reply
  6. *protectedSean Lv' Blog says

    12/25/2012 at 1:00 pm

    Hi William

    I would like to deploy the latest ESXi 5.1 (I mean it include the newest patches) via PXE.

    I plan to include some commands in kickstart.cfg, for example,
    esxcli software vib install -d /vmfs/volumes/$(hostname -s)-local-storage-1/patches/ESXi510-201212001.zip

    I am not quite familiar with applying patches to ESXi 5.x, maybe i have 2 ways to make the goals.
    1, Integrate the newest patches to installation resource.
    2, Controlled by kickstart.cfg, includes commands to apply patch after installation in the %firstboot stage.

    kindly please provide me some suggestion. thanks

    Reply
    • *protectedWilliam says

      12/25/2012 at 9:18 pm

      Sean,

      ESXi patches are cumulative and replaces the entire ESXi image (unlike classic ESX, where you had individual patches). This makes patching extremely easy for ESXi. So if you're going to use kickstart, I would recommend getting the latest patch and then generate a new ESXi ISO image which you can then use for your kickstart. Take a look at this article for more details on creating a new ISO Image with a patch http://blogs.vmware.com/vsphere/2012/08/creating-an-iso-image-from-a-vmware-patch-file.html

      Reply
    • *protectedSean Lv' Blog says

      12/26/2012 at 9:22 am

      Hi William

      many thanks for you introduced the way to build ISO with lasted patches. it's very useful. Considering my deployment scenario, the maintenance efforts for ESXi PXE deployment is a little complex. Besides the further patches download, i also need to do
      1, Use PowerCLI to re-build lasted ISO
      2, extract the ISO to PXE depot
      3, verify or modify chainloader configuration file (BOOT.CFG), because in my environment, I use the modified BOOT.CFG, something like below

      ---------------------------------
      kernel=/ESXi51/tboot.b00
      kernelopt=runweasel ks=http://10.254.196.6/pxeboot/ESXi51/answerfiles/ks_esxi51_default.cfg
      modules=/ESXi51/b.b00 --- /ESXi51/useropts.gz ......... more
      ----------------------------------

      so if considering my specific application, is there any other way to always make sure users get newest ESXi 5.x deployed with my less maintenance efforts?

      I checked your another great post (http://www.virtuallyghetto.com/2012/09/a-pretty-cool-method-of-upgrading-to.html) and tried this way, it seems the resource is required to be downloaded from internet. My question is how to build a local depot, which could help ESXi upgrade more efficiently?

      thank you in advanced. ๐Ÿ™‚ Nice Day!

      Reply
  7. *protectedAnonymous says

    02/17/2013 at 7:34 pm

    Nice work, William. Here's a suggestion to skip extra pipes (grep | awk) & take advantage of awk's powerful pattern matching. Above where you have the command...

    GATEWAY=$(localcli network ip route ipv4 list | grep default | awk '{print $3}')

    ...you can shorten it w/ simple awk pattern matching...

    GATEWAY=$(localcli network ip route ipv4 list | awk '/default/ {print $3}')

    Reply
  8. *protectedAnonymous says

    03/04/2013 at 1:14 pm

    Hi.

    I was wondering, is it possible to install vibs from the ks.cfg? I have tryed this:
    esxcli software vib install -d /path where the vib is.. in the ks, but it does not work. Any idea of what I'm missing? It works manually after the install is finished.

    Also, I want to run a .sh from the ks, but after changing the .sh to be executable, the ks.cfg ignores the part where i try to run it... And after ESXi 5.1 is installed, i still have a problem running the .sh manually, something happens to the file in the installation, and it ends with an ?. The same goes for .vim files, when i write this in the ks: wget ftp:///template.vmx -O /tmp/template.vmx the file looks like this after the install: template.vmx?

    I can't figure out what the problem is. Hopefully you have an answer for me ๐Ÿ™‚

    Thanks in advanced ๐Ÿ˜‰

    Reply
    • *protectedWilliam Lam says

      03/04/2013 at 4:22 pm

      This all works fine, but just make sure you're doing this in the %post section of your kickstart.

      Reply
    • *protectedAnonymous says

      03/05/2013 at 9:44 am

      Hi, thank you for answering me.

      I tried to add the %post section, but it failed.

      Error (see log for more info):
      User-supplied script failed. (Error code 512)

      This is how the %post section of my kickstart looks like..

      %post --interpreter=busybox --ignorefailure=false

      mkdir /depot

      # Installing hardware monitoring...
      wget ftp://ip/hp-esxi5.0uX-bundle-1.1.2-4.zip -O /depot/hp-esxi5.0uX-bundle-1.1.2-4.zip
      esxcli software vib install -d /depot/hp-esxi5.0uX-bundle-1.1.2-4.zip

      # Install esxcli-shell plugin
      esxcli software acceptance set --level CommunitySupported
      wget ftp://ip/esxcli-shell-1.1.0-15-offline_bundle.zip -O /depot/esxcli-shell-1.1.0-15-offline_bundle.zip
      esxcli software vib install -d /depot/esxcli-shell-1.1.0-15-offline_bundle.zip

      wget ftp://ip/newVM.sh -O /depot/newVM.sh

      wget ftp://ip/template.vmx -O /depot/template.vmx

      chmod +x /depot/newVM.sh
      chmod +x /depot/template.vmx

      sh /depot/newVM.sh

      Reply
    • *protectedAnonymous says

      03/05/2013 at 11:50 am

      I don't know what logs to read.. Or what I'm looking for in the log.

      Reply
    • *protectedWilliam Lam says

      03/05/2013 at 2:35 pm

      First off with any type of kickstart/script development, make sure you try out the above commands to ensure they work. I would not recommend putting patches in the root directory, usually they can get pretty large and you may fill up the main filesystem. You should store the files in a local datastore. In terms of logs, you should take a look at /var/log/esxi_install.log which you should get familiar with as it provides all the details of your install including %pre & %post section and you'll probably want to copy that off to local datastore as it is not persisted over a reboot (take a look in the kickstart example I have).

      Reply
  9. *protectedAnonymous says

    03/19/2013 at 3:05 pm

    Please check that your password doesn't contain # (hash) or = (equal) for starters

    the password #=8#=7a99Jj didn't work

    Reply
  10. *protectedAnonymous says

    03/26/2013 at 1:42 pm

    Hi.

    If I wanted to install on a SD card, what would the command be then?

    I have used the following to install on a USB:
    install --firstdisk=usb-storage --overwritevmfs --novmfsondisk

    But instead of usb-storage, I want sd-card, but it doesn't work. What do I write?

    Thanks in advance ๐Ÿ™‚

    Reply
    • *protectedAnonymous says

      04/08/2013 at 6:06 am

      Can someone answer this?

      Thank you so much in advance!

      Reply
  11. *protectedsaurin says

    04/05/2013 at 5:25 pm

    Hi,

    I tried to install using this it is working, one question about assigning a license key, i saw there is no %post section written on this kickstart, when i moved the license key related step to %post, it is unable to apply license during post, so i am getting warning message about evaluation. however it applies the license key during %firstboot but i don't want message about evaluation. How to get rid of that?

    Thanks

    Reply
    • *protectedWilliam Lam says

      04/05/2013 at 5:31 pm

      It's a best practice to do all post configurations in %firstboot if it isn't needed during %post as hostd isn't up and running vim-cmd will not work. Once the license is assigned, then you should not get that message. Are you saying that you're still seeing the message even after assigning it?

      Reply
    • *protectedsaurin says

      04/05/2013 at 5:49 pm

      Thanks William,

      i am not getting evaluation message after %firstboot(if i apply license in %firstboot)

      but if i assign license in %firstboot, it is giving me evaluation related warning after esxi installation(before machine gets rebooted and execute %firstboot), i want to get rid of the warning message i am getting just before machine reboot.

      is that any other way to assign a license key using some different command? that i can use during %post ?

      just a thought, if it is ok to assign a license during %firstboot why it is checking the license during %post (or before %firstboot)

      Reply
    • *protectedWilliam Lam says

      04/07/2013 at 4:09 pm

      I was just taking a look at the ESXi 5.1 Scripted Install documentation http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vsphere.install.doc%2FGUID-61A14EBB-5CF3-43EE-87EF-DB8EC6D83698.html and it turns out you can specify the Serial as part of the ks.cfg, by using --esx=KEY If not specified, it'll go into eval mode

      Reply
  12. *protectedAnonymous says

    04/08/2013 at 7:41 am

    Hi.

    I would also know how to install on a SD card. My USB's cause many warnings, so it would be nice to try SD card..

    And another thing; I try do copy the installation log files to a different partition, but with no luck. After a reboot, they get deleted!? Any thoughts on how to fix this? I need the log files...

    Thanks in advance

    Reply
    • *protectedrock425a says

      12/05/2013 at 7:14 pm

      In our environment, we install to SD cards using kickstart all the time. I use a usb key for my install media and ks files.

      Try this:
      install --firstdisk=local --overwritevmfs --novmfsondisk

      One thing to note, due to the order of devices at boot, I have found that you MUST place your USB stick in the rear of an R720 for this to work, otherwise it will install esxi overtop of your install media.

      Reply
      • *protectedjuang says

        09/22/2017 at 7:03 am

        Thanks for posting that worked great for me on a R730 as well!

        Reply
  13. *protectedAlex says

    04/25/2013 at 12:32 pm

    Hi. Great post!

    I'm trying to create a standard kickstart that reads from separate files.I want to install esxi 5.1 several times, but with different ip's, name and configs.. (diskname, ip, domainname, license key, packages to install etc)

    I tried your example with the %include /../.. and extracting the information, but with no luck. Is there other ways to achieve this?

    I'm using the busybox interpreter, and I have trouble with the HDD's which results in having to know the exact name of the HDD, so I want to have this read from a file so I don't have to edit the kickstart each time...

    Hope you understand what I'm asking and have an answer for me.

    Thank you in advance!

    Reply
    • *protectedAnonymous says

      05/02/2013 at 7:29 am

      warning:/tmp/cfg:line 1: argument "--bootproto" to command "network" set but an invalid value was specified.
      warning:/tmp/cfg:line 1: argument "--hostname" to command "network" is missing a value.
      warning:/tmp/cfg:line 1: argument "--ip" to command "network" is missing a value.
      warning:/tmp/cfg:line 1: argument "--netmask" to command "network" is missing a value.
      warning:/tmp/cfg:line 1: argument "--gateway" to command "network" is missing a value.
      warning:/tmp/cfg:line 1: argument "--nameserver" to command "network" is missing a value.
      warning:/tmp/cfg:line 1: no bootproto set. Defaulting to DHCP.

      I followed your example. But it didn't work. Any thoughts on why?

      This is what my pre section looks like. I also have tryed bootprot=static, but then the installation fails..

      %pre --unsupported --interpreter=busybox

      CMDLINE_FILE=/tmp/cmdline
      ESXI_INSTALL_LOG=/var/log/esxi_install.log

      # Extract boot options
      vsish -e get /system/bootCmdLine > ${CMDLINE_FILE}

      # Extract and set variables
      HOSTNAME=$(cat ${CMDLINE_FILE} | grep hostname | sed -e 's/.*hostname=\([^ ]*\).*/\1/')
      IP=$(cat ${CMDLINE_FILE} | grep ip | sed -e 's/.*ip=\([^ ]*\).*/\1/')
      NETMASK=$(cat ${CMDLINE_FILE} | grep netmask | sed -e 's/.*netmask=\([^ ]*\).*/\1/')
      GATEWAY=$(cat ${CMDLINE_FILE} | grep gateway | sed -e 's/.*gateway=\([^ ]*\).*/\1/')
      NAMESERVER=$(cat ${CMDLINE_FILE} | grep nameserver | sed -e 's/.*nameserver=\([^ ]*\).*/\1/')
      VIRTUAL_SWITCH_GROUP=$(cat ${CMDLINE_FILE} | grep virtual_switch_group | sed -e 's/.*virtual_switch_group=\([^ ]*\).*/\1/')

      # Set the network configuration on the first network adapter
      echo "network --bootproto=none --hostname=${HOSTNAME} --ip=${IP} --netmask=${NETMASK} --gateway=${GATEWAY} --nameserver=${NAMESERVER} --addvmportgroup=0" > /tmp/cfg

      Reply
  14. *protectedGunasekaran Siva says

    06/03/2013 at 6:49 am

    Hi William,

    please let me know the procedure to have scripted installation with pxe boot. currently i am using Shift+O method to install ESXi 5.1.

    *protected email*

    Thanks,
    Guna

    Reply
  15. *protectedๅฟƒๆ— ็ต็Š€ says

    06/25/2013 at 7:54 am

    # enable & start remote ESXi Shell (SSH)
    vim-cmd hostsvc/enable_ssh
    vim-cmd hostsvc/start_ssh

    does not work in my enviroment, does kickstart leave any log to examine?

    Kevin

    Reply
  16. *protectedPatrick says

    07/12/2013 at 1:17 am

    Truly an awesome article that helped me out tons! The best documentation and example I've found for the ESXi automated install! Thank you! Thank you! Thank you!

    Reply
  17. *protectedRahul says

    06/21/2014 at 4:49 am

    I want to copy the OVA's to the datastore and deploy them offline. But I am not able to do it

    I copied the files in ova directory and used the following command:

    cp -R /vmfs/volumes/CDROM/OVA/* /vmfs/volumes/datastore1/

    but did not succed, can you help me on this?

    Reply
  18. *protectedRex says

    07/29/2015 at 10:39 am

    Are there have the way let the ESXi host auto join the vDS in kickstart ?

    Reply
  19. *protectedChris says

    09/23/2015 at 2:49 pm

    great work ... thank you!

    Reply

Trackbacks

  1. Fix Kickstart Error Log Windows XP, Vista, 7, 8 [Solved] says:
    11/20/2014 at 3:19 pm

    […] Automating ESXi 5.1 Kickstart Tips & Tricks | โ€ฆ โ€“ There is not a whole lot of changes for kickstart configurations between ESXi 5.1 and ESXi 5.0, majority of the tips and tricks noted in the ESXi 5.0 kickstart guide …… […]

    Reply

Leave a Reply to PatrickCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Tokenย  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025