NeoSmart Knowledgebase

Upgrading ESXi 6.5 automatically from the command line without vSphere

The traditional approach to upgrading vSphere and VMware ESXi involves manually downloading the VIB (short for “vSphere Installation Bundle”) and executing the ESXi esxcli command line VIB installer from an ESXi console or SSH session. However, not many realize that esxcli is actually a full-fledged package manager, and can be used to automatically check for updated packages and install them accordingly, in a similar vein to apt or yum.

Using esxcli in this fashion is actually surprisingly easy, but it does entail typing out the “depot” URL and providing it to esxcli as a command line argument each time. VMware ESXi and vSphere use this XML file to provide an index of the latest available packages and their version numbers, and can compare the contents against what’s installed locally to upgrade packages as needed.

The first step is to make sure that the VMware ESXi SSH service is up and running, so that you can log in remotely to run the esxcli update/upgrade commands. This can be done from the “Services” menu in the vSphere client, or from the “Security Profile” section of the “Configuration” tab in vSphere Client:

Starting the vSphere/ESXi SSH service via vSphere Client. Click on the image to zoom in.

 

Starting the SSH service via the vSphere/ESXi web management interface.

 

Once the SSH service has been enabled, log on to the ESXi server in question over SSH, typically by running ssh root@IPADDR where IPADDR is the address of the vSphere/ESXi host you would like to upgrade. Windows users will likely use putty to establish the SSH connection instead.

When you’ve logged in to the ESXi machine securely over SSH, enter the following at the terminal prompt. We recommend copy-and-pasting from below to make sure everything is typed in correctly:

esxcli software vib update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

Note that running this command may take awhile, during which the process will appear to be hung. Do not close the SSH connection or attempt to stop the upgrade! esxcli will connect to the URL we provided and use that to obtain a list of the latest versions of all packages, then upgrade all outdated packages in the process.

Once the upgrade has finished, esxcli will print information about all the updates installed to the terminal. At this point, it’s necessary to reboot the ESXi server to use the updated version of the software. If all guests have already been safely shutdown and the server is in maintenance mode (if needed), the vSphere/ESXi server may be rebooted from the SSH session by typing in

reboot

followed by the Enter key.

Propose an edit