Kickstart ESXi

From HackerNet
Jump to: navigation, search

ESXi 5.5

accepteula
install --firstdisk --overwritevmfs
#For USB install use below
#install --firstdisk --novmfsondisk
rootpw bueno
reboot

network --bootproto=static --device=vmnic0 --hostname=esxi2.hackernet.se --ip=172.20.0.2 --netmask=255.255.255.0 --gateway=172.20.0.1 --nameserver=172.20.0.10 --addvmportgroup=false

%firstboot --interpreter=busybox

#If planning on running nested ESXi, uncomment
#grep -i "vhv.enable" /etc/vmware/config || echo "vhv.enable = \"TRUE\"" >> /etc/vmware/config

#SSH
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1

vim-cmd hostsvc/datastore/rename datastore1 "LocalHDD"
vim-cmd vimsvc/license --set 11111-BBBBB-CCCCC-BH951-CAW3U
esxcli system module parameters set -m tcpip3 -p ipv6=0

cat > /etc/ntp.conf << __NTP_CONFIG__
restrict default kod nomodify notrap noquerynopeer
restrict 127.0.0.1
server 0.vmware.pool.ntp.org
server 1.vmware.pool.ntp.org
__NTP_CONFIG__
/sbin/chkconfig ntpd on


# vSwitch0
esxcli network vswitch standard set --mtu 9000 --cdp-status both --vswitch-name vSwitch0
esxcli network vswitch standard portgroup add --portgroup-name LAN --vswitch-name vSwitch0

# vSwitch1
esxcli network vswitch standard add --ports 256 --vswitch-name vSwitch1
esxcli network vswitch standard uplink add --uplink-name vmnic1 --vswitch-name vSwitch1
esxcli network vswitch standard set --cdp-status listen --vswitch-name vSwitch1
esxcli network vswitch standard portgroup add --portgroup-name WAN --vswitch-name vSwitch1

# vSwitch2 
esxcli network vswitch standard add --ports 256 --vswitch-name vSwitch2
esxcli network vswitch standard uplink add --uplink-name vmnic2 --vswitch-name vSwitch2
esxcli network vswitch standard set --mtu 9000 --cdp-status both --vswitch-name vSwitch2
esxcli network vswitch standard portgroup add --portgroup-name DMZ1 --vswitch-name vSwitch2
esxcli network vswitch standard portgroup set --portgroup-name DMZ1 --vlan-id 1
esxcli network vswitch standard portgroup add --portgroup-name DMZ2 --vswitch-name vSwitch2
esxcli network vswitch standard portgroup set --portgroup-name DMZ2 --vlan-id 2

Unattended KS fil

#
# ESXi kickstart file.
#
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password
rootpw Pa$$w0rd
# The install media is the SD drive
clearpart --firstdisk --overwritevmfs
install --firstdisk --overwritevmfs
# Set keyboard to Swedish
keyboard Swedish
# Set an static ip on the Management lan on vmnic3(Port 4 on server)
#ESXi hostnam & ip
network --bootproto=static --device=vmnic3 --ip=192.168.204.242 --gateway=192.168.204.7 --netmask=255.255.255.0 --hostname=ESXi