- Enable SSH on your ESX server and setup certificate based authentication. This will greatly ease your work as you can then pipe configuration commands through SSH, which in turn allows you to script the whole configuration (and yes, this all works with the free version of ESXi). I can now perform all of the configuration for 100+ ESX servers in a few seconds. On the ESX server the public keys for your Linux servers go in a file called:
/etc/ssh/keys-root/authorized_keys
- I also like to change the motd, shell profile, and ntp.conf at the same time. I just copy these files over. The shell profile goes in a file called: /etc/profile.local
My profile.local files looks like this:
# profile.local
PS1="[\u@\h]:\w-> "
export PS1
if [ "$TERM" != "dumb" ]; then
alias ls='ls --color=auto'
alias ll='ls -l -a --color=auto'
fi
- Configure DNS and Hostname settings
ssh root@x.x.x.x "esxcli network ip dns server add --server=192.168.0.11"
ssh root@x.x.x.x "esxcli network ip dns server add --server=192.168.0.11"
ssh root@x.x.x.x "esxcli system hostname set --host=esxserver01"
ssh root@x.x.x.x "esxcli system hostname set --domain=mydomain.com"
- Configure NTP Settings
Copy over a valid ntp.conf file to /etc/ntp.conf
ssh root@x.x.x.x "esxcli network firewall ruleset set --enabled=true --ruleset-id=ntpClient"
ssh root@x.x.x.x "chkconfig --add ntpd"
- License ESX
ssh root@x.x.x.x "vim-cmd vimsvc/license --set xxxxx-xxxxx-xxxxx-xxxxx-xxxx"
- Setup any networking you need. For my setup, I need to rename the first port group and create a new vswitch with a port group. You also need to change the failover state as it defaults to non active. This is how I did that.
ssh root@x.x.x.x "esxcli network vswitch standard portgroup remove -p \'VM Network\' -v vSwitch0"
ssh root@x.x.x.x "esxcli network vswitch standard portgroup add -p \'Trusted Network\' -v vSwitch0"
ssh root@x.x.x.x "esxcli network vswitch standard add -v vSwitch1"
ssh root@x.x.x.x "esxcli network vswitch standard portgroup add -p \'Client Network\' -v vSwitch1"
ssh root@x.x.x.x "esxcli network vswitch standard uplink add -u vmnic1 -v vSwitch1"
ssh root@x.x.x.x "esxcli network vswitch standard policy failover set -a vmnic1 -v vSwitch1"
- Reboot ESX server so all change take effect
ssh root@x.x.x.x "reboot"
Somewhere between order, disorder, and chaos exists the life in which we live. My views of time and space and everything else therein reflects my never ending war with Entropy.
Saturday, December 21, 2013
Configuring VMware ESX 5.5 from the command line
Over the past few months I have spent a lot of time building a large ESX and nested ESX infrastructure based on VMware ESX 5.5. As you do this, you quickly realize that configuring ESX from the UI is painful, especially when you need to make sure you have all of the ESX servers exactly the same. Here are some tips and tricks that I have found to be very helpful.
Subscribe to:
Posts (Atom)