Upgrading ESX hosts via ssh the lazy way :-)

Upgrading ESX hosts via ssh the lazy way :-)

My VMware homelab, as does any environment, needs updates from time to time. And because I use Intel NUC’s that don’t have a keyboard/mouse and monitor attached to them upgrading via USB stick is not the ideal way. So i started searching online on how to fix this and it is surprisingly simple :-). In the following walkthrough I’ll demonstrate how I made it work without leaving my desk :-). There are 2 options for this, via internet or by uploading the update to a data store. Both options are in this blog.

First things first log on to your ESXi host via the website and shutdown all VM’s.

After that put the host in maintenance mode and enable SSH.

If Enable Secure Shell (SSH) is not working go over to manage and services and enable the ssh service

Once the host is in maintenance mode, connect to the IP-address of the host via SSH (via putty or terminal).

In my case I’m using terminal on MacOS so the command is:
ssh root@ipadress

After login via SSH run this command to enable outbound http traffic from the host to the internet. This also means that your internal infrastructure must allow access to the internet from the ESX Host

esxcli network firewall ruleset set -e true -r httpClient

o view the current installed version and profile

esxcli software profile get

This will give you a list of installed software en versions (mind this is a long list, the required information is on the top of the list)

Next use this command to retrieve the available updates based on the ESXi version you have

esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep -i ESXi-7
In my case I’m using ESXi-7 standard so the highlighted version is the latest version that is available. So I’ll update to that version using this command where PACKAGE NAME is the name of the update package (in my case ESXi-7.0U2d-18538813-standard)
esxcli software profile update -p PACKAGE-NAME -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

This will run the upgrade.

After the upgrade you get a screen saying (hopefully 😉 the upgrade completed successfully.

It will also say reboot required = true.

To reboot the host, type reboot in the command line and hit enter.

reboot

After reboot put the host in production mode by removing maintenance mode, and start the necessary VM’s.

If your host has no access to the internet repository’s you can follow these steps:

Login to your free MyVmware.com account and download the latest patches http://www.vmware.com/patchmgr/download.portal.

upload these patches to a data store that the host can connect to. This upload can be done via the ESXi webportal.

esxcli software vib update -d /vmfs/volumes/<your_datastore>/<name_of_the_patch_you_uploaded.zip

Hope this helps!

Leave a Reply