If there is one thing when it comes to lab environments of people in the networking field that can be agreed on, it is that VMWare ESXi is a widely used product. Part of the reason is obviously the VERY functional free license that they give you. A lot of people have been using this for a while as well and need to upgrade. One of my home VM hosts was in the same situation. I was on an older version and needed to upgrade to get the new ESXi web interface that I was enjoying on my other, new VM host.
So I was looking for a simple, straight forward command line ESXi upgrade process to get all of my servers upgraded to version 6.5… and here’s what I found.
There are three things you need to do to get started. They are (in order):
- Enable SSH (you can do this via the gui or the console interface)
- Put your host in maintenance mode
- Enable outbound http connections in the ESXi firewall.
As mentioned, the first step is enabling the SSH interface. This can be done via the existing gui that you are using as well as from the console interface of the server. Then you will want to open a SSH session for the rest of this.
Next step is putting the host in maintenance mode to protect the virtual machines while the upgrade process is in progress. The virtual machines will be shut down by this step. I will put my disclaimer out there as well and say that you should always have some sort of backup as well… just in case! Then, when ready, enter the following command from the command line to put your host in maintenance mode. (This can also be done through the gui if you so choose)
Next you want to allow outbound HTTP connections through the built in ESXi firewall. This allows the host to reach out to the VMWare servers to download the updates needed.
esxcli network firewall ruleset set -e true -r httpClient
The Upgrade Process Itself
Now it’s time for the actual upgrade. First you need to select the specific version you want to go to. From your SSH session, it looks like this:
esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep ESXi-6.5
Notice the end of that command. You can use grep to filter for specific versions. In this case, I filtered specifically for versions of ESXi 6.5. Once you have your output and determine the version that you wish to use, you can launch the actual upgrade. Notice I selected a version as an example on the end of the command.
esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-6.5.0-20180501001s-standard
The process will begin to run and will take a bit. Once complete, you will need to reboot your host to finish loading the new version. Once rebooted, start a new SSH session. You can then exit maintenance mode to complete the process:
And that should do it. You can begin to bring your VMs back online and operational. This is the process that I’ve used a few times on a few hosts now and it’s worked great. Nice and easy to do and not a big hassle. As always, I recommend a backup just to be safe, but from a personal experience, I haven’t had an issue yet with this method. Good luck!