How to Slipstream VMware ESX Install

Create a Bootable VMware install as usual on USB Memory Stick

Dump the below into a file called ks.cfg ( Change the value in the square brakets before and put it on the root of the usb with overwriting the isolinux.cfg with the one below , change the menu options for your enviroment

ks.cfg

# +-----------------------------------+
# | Begin default install    |
# +-----------------------------------+
# VMWare License options accepting EULA
vmaccepteula
# Partitioning
clearpart --firstdisk=hpsa --overwritevmfs
install --firstdisk=hpsa --overwritevmfs
 
# root Password encrypted ( use openssl passwd -1 to generate)
rootpw --iscrypted [ENCRYTPEDPASSWORD\
 
# Network install type
network --device=vmnic0 --bootproto=DHCP
%post --interpreter=busybox
Echo Installing ESXi
#Reboot after copying image to disk
reboot
%firstboot --interpreter=busybox
 
# Set the serial number for ESXi (please change it) 
serialnum --esx=[SERIAL NUMBER ]
 
# +---------------------------------------------------------------------------+
# | Creating Networks                            |
# +---------------------------------------------------------------------------+
 
# Remove vSwitch0
sleep 30
esxcli network ip interface remove -i vmk0
esxcli network vswitch standard portgroup remove -p 'Management Network' -v vSwitch0
esxcli network vswitch standard remove -v vSwitch0
 
# Create management switch
esxcli network vswitch standard add --vswitch-name vSwitch1
# Add nics
esxcli network vswitch standard uplink add --uplink-name vmnic0 --vswitch-name vSwitch1
esxcli network vswitch standard uplink add --uplink-name vmnic1 --vswitch-name vSwitch1
esxcli network vswitch standard uplink add --uplink-name vmnic2 --vswitch-name vSwitch1
 
# Add Port Groups  
 
esxcli network vswitch standard portgroup add --portgroup-name "Management Network" --vswitch-name vSwitch1  
esxcli network vswitch standard portgroup set --portgroup-name "Management Network" --vlan-id 4  
 
esxcli network vswitch standard portgroup add --portgroup-name "Server Network" --vswitch-name vSwitch1  
 
# Configure vmkNIC
esxcli network ip interface add -i vmk0 -p 'vMotion Network'
# Set IP Settings [HOSTIP] is dynamic resolved from the template
esxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=[HOSTIP] -N 255.255.255.0 -t static
# Set default gateway
esxcfg-route -a default [HOSTGW]
# Put management nics to active
esxcli network vswitch standard policy failover set --active-uplinks vmnic0 --vswitch-name vSwitch1
esxcli network vswitch standard policy failover set --active-uplinks vmnic1 --vswitch-name vSwitch1
esxcli network vswitch standard policy failover set --active-uplinks vmnic2 --vswitch-name vSwitch1
 
echo Create VMotion and Mangement network
# +---------------------------------------------------------------------+
# | Creating vMotion and Mangement Network                                        |
# +---------------------------------------------------------------------+
 
# Create vMotion vSwitch
esxcli network vswitch standard add --vswitch-name vSwitch0
# Add nics
esxcli network vswitch standard uplink add --uplink-name vmnic3 --vswitch-name vSwitch0
# Add portgroups
esxcli network vswitch standard portgroup add --portgroup-name vMotionNetwork --vswitch-name vSwitch0
 
# Configure vmkNIC
esxcli network ip interface add -i vmk1 -p 'vMotionNetwork'
esxcli network ip interface ipv4 set --interface-name=vmk1 --ipv4=[VMOTIONIP] --netmask=255.255.255.0 --type=static
 
# +---------------------------------------------------------------------------+
# | enable VMotion                                          |
# +---------------------------------------------------------------------------+
vim-cmd hostsvc/vmotion/vnic_set vmk3
vim-cmd internalsvc/refresh_network
 
# Set DNS and hostname
esxcli system hostname set --fqdn=[HOSTNAME]
esxcli network ip dns server add --server=[DNS1]
esxcli network ip dns server add --server=[DNS2]
#echo add DNS configuration
echo search cotton-on.local  > /etc/resolv.conf
echo nameserver 10.0.0.8  >> /etc/resolv.conf
echo nameserver 10.0.0.5 >> /etc/resolv.conf
 
echo Configure NTP
# +--------------------------------------------------------------------+
# | Add NTP Settings                                                   |
# +--------------------------------------------------------------------+
# Backup
mv /etc/ntp.conf /etc/ntp.conf.bak
# ntp.conf creation
cat > /etc/ntp.conf << __NTP_CONFIG__
restrict default kod nomodify notrap noquerynopeer
restrict 127.0.0.1
server au.pool.ntp.org
__NTP_CONFIG__
/sbin/chkconfig --level 345 ntpd on
echo "driftfile /etc/ntp.drift" >> /etc/ntp.conf
 
echo Configure Syslog
# +--------------------------------------------------------------------+
# | Add syslog confiuration to ESX host                                   |
# +--------------------------------------------------------------------+
# No Remote Syslog server
# vim-cmd hostsvc/advopt/update Syslog.Remote.Hostname string telesto
#vim-cmd hostsvc/advopt/update Syslog.Local.DatastorePath string "[datastore] /logfiles/$(hostname -s).log"
 
#Disable MOB
vim-cmd proxysvc/remove_service "/mob" "httpsWithRedirect"
# +--------------------------------------------------------------------+
# | SNMP Trap                                                            |
# +--------------------------------------------------------------------+
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><config><snmpSettings><enable>true</enable><syscontact></syscontact><syslocation></syslocation><EnvEventSource>indications</EnvEventSource><communities></communities><port>161</port><targets>[SNMPIP]@161 [SNMPTRAP]</targets><loglevel>info</loglevel><authProtocol></authProtocol><privProtocol></privProtocol></snmpSettings></config>" > /etc/vmware/snmp.xml
 
echo Rename local datastore
# +---------------------------------------------------------------------------+
# | Rename local datastore if --novmfsondisk is not used                      |
# +---------------------------------------------------------------------------+
vim-cmd hostsvc/datastore/rename datastore1 "local-[hostname]"
 
 
# backup ESXi configuration to persist changes
/sbin/auto-backup.sh
 
#enter maintenance mode
esxcli system maintenanceMode set -e true
 
# Needed for configuration changes that could not be performed in esxcli
esxcli system shutdown reboot -d 60 -r "Rebooting after host configurations"

 

isolinux.cfg

DEFAULT menu.c32
MENU TITLE ESXi Boot menu
NOHALT 1
PROMPT 0
TIMEOUT 300
 
LABEL install 
 KERNEL mboot.c32 
 APPEND -c boot.cfg 
 MENU LABEL ^ESXi Setup Interactively install
 
Label ESXi USB install scripted 
 KERNEL mboot.c32 
 APPEND -c boot.cfg ks=usb:/ks.cfg
 MENU LABEL ^USB install Scripted install 
 IPAPPEND 1
 
Label ESXi NFS install scripted 
 KERNEL mboot.c32 
 APPEND -c boot.cfg ks=nfs:uncpath/of/share/ks.cfg
 MENU LABEL ^NFS Scripted install 
 IPAPPEND 1
 
Label ESXi http install scripted 
 KERNEL mboot.c32 
 APPEND -c boot.cfg ks=http://www.website.com/ks.cfg
 MENU LABEL ^HTTP Scripted install 
 IPAPPEND 1
 
LABEL hddboot 
 LOCALBOOT 0x80 
 MENU LABEL ^Boot from local disk

 

 

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...