Requirements
To follow this topic, you need the following:
- An USB stick with 8GB at least
- Rufus to prepare the USB stick
- ISO of VMware ESXi 6.5
Prepare the USB stick
To prepare the USB stick, plug it into your computer and run Rufus. This software is portable. Select the ISO image of ESXi 6.5 and set Rufus as the following screenshot:

If you have the following message when you start the format, just click on Yes.

Build the unattend file
To deploy my ESXi, I have used the following script. You can find an explanation in the comments. This script can be used for each ESXi to deploy while the static IP in DHCP and DNS are set.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
| #Accept VMware License agreementaccepteula# Set the root passwordrootpw MyPassword# Install ESXi on the first disk (Local first, then remote then USB)install --firstdisk --overwritevmfs# Set the keyboardkeyboard French# Set the networknetwork --bootproto=dhcp# reboot the host after installation is completedreboot# run the following command only on the firstboot%firstboot --interpreter=busybox# enable & start remote ESXi Shell (SSH)vim-cmd hostsvc/enable_sshvim-cmd hostsvc/start_ssh# enable & start ESXi Shell (TSM)vim-cmd hostsvc/enable_esx_shellvim-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# Get Network adapter informationNetName="vmk0"# Get the IP address assigned by DHCPIPAddress=$(localcli network ip interface ipv4 get | grep "${NetName}" | awk '{print $2}')#Get the netmask assigned by DHCPNetMask=$(localcli network ip interface ipv4 get | grep "${NetName}" | awk '{print $3}')# Get the gateway provided by DHCPGateway=$(localcli network ip interface ipv4 get | grep "${NetName}" | awk '{print $6}')DNS="10.10.0.229"VlanID="50"# Get the hostname assigned thanks to reverse lookup zoneHostName=$(hostname -s)SuffixDNS="vsphere.lab"FQDN="${HostName}.${SuffixDNS}"# set static IP + default route + DNSesxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=${IPAddress} --netmask=${NetMask} --type=static --gateway=${Gateway}esxcli network ip dns server add --server ${DNS}# Set VLAN IDesxcli network vswitch standard portgroup set --portgroup-name "Management Network" --vlan-id 50#Disable ipv6esxcli network ip set --ipv6-enabled=0# set suffix and FQDN host configurationesxcli system hostname set --fqdn=${FQDN}esxcli network ip dns search add --domain=${SuffixDNS}# NTP Configuration (thanks to http://www.virtuallyghetto.com)cat > /etc/ntp.conf << __NTP_CONFIG__restrict default kod nomodify notrap noquerynopeerrestrict 127.0.0.1server 0.fr.pool.ntp.orgserver 1.fr.pool.ntp.org__NTP_CONFIG__/sbin/chkconfig ntpd on# rename local datastore to something more meaningfulvim-cmd hostsvc/datastore/rename datastore1 "Local - $(hostname -s)"# restart a last timereboot |
Save the file and name it ks.cfg. Copy the file in the root of the USB stick.
Use the unattend file during deployment
Now we have to configure the boot the load the ks.cfg automatically for the deployment. Open the USB stick and edit Boot.cfg. Replace the following line kernelopt=runweasel by kernelopt=ks=usb:/ks.cfg.
Unplug the USB Stick and plug it on the server. You can boot the USB key to run the installer.
Deployment
During deployment, the installer will load the ks.cfg config file.

It starts by check if the config file is correct.

After the first reboot, the installer configures the ESXi as specified in the config file.

Once the system has rebooted for a second time, the configuration is finished.

For example, the SSH and the ESXi Shell are well enabled.

Conclusion
VMware provides a way to deploy quickly standard ESXi. If your infrastructure is not ready and you have not yet Auto Deploy, the deployment with unattended file can be a good option.
No comments:
Post a Comment