Installing ESXi updates from the commandline

If you run a small home server, a test setup or a server in a very constrained environment like a DMZ you probably don’t have tools like VMware Update Manager available to apply patches to your ESXi server(s).

In this post I will use the 24 Oct 2012 KB2034549 update on a ESXi 5.1 server as an example to explain how you can patch a server from the commandline. You can find patches on The VMware Download Portal.

First prepare by:

  • downloading the update;
  • checking the sha1sum to verify the download;
  • placing the file on a location reachable (HTTP/FTP/local VMFS) by your server;
  • logging on to a root shell of the server (console/SSH).

Note: In this example I placed the bundle in the local /vmfs/volumes/datastore1/Updates/ESXi510-201210001.zip.

To manipulate the packages installed on a system there is the esxcli software command, running esxicli software will show you what options are available.

~ # esxcli software
Usage: esxcli software {cmd} [cmd options]

Available Namespaces:
sources               Query depot contents for VIBs and image profiles
acceptance            Retrieve and set the host acceptance level setting
profile               Display, install, update or validates image profiles
vib                   Install, update, remove, or display individual VIB packages

In this case the most relevant option is the esxcli software vib command.

Check which VIBs are contained in the bundle (zip) by running:

esxcli software sources vib list -d /vmfs/volumes/datastor
e1/Updates/ESXi510-201210001.zip

If the previous listing does not show anything unexpected you can update the system by running:

esxcli software vib update -d /vmfs/volumes/datastor
e1/Updates/ESXi510-201210001.zip

The update command will generate some output showing the installed, removed and skipped packages. It will also show if a reboot will be required to finalize the update.

Installation Result
Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
Reboot Required: true
VIBs Installed: VMware_bootbank_esx-base_5.1.0-0.5.838463
VIBs Removed: VMware_bootbank_esx-base_5.1.0-0.0.799733
VIBs Skipped: VMware_bootbank_ata-pata-amd_0.3.10-3vmw.510.0.0.799733,
<.. removed for brevity ..> , VMware_locker_tools-light_5.1.0-0.0.799733

In this case a reboot is required as a base component has been updated.

Afterwards you can verify that the server has been updated by running a vib list and grep’ing for the name of the VIB:

~ # esxcli software vib list |grep esx-base

This will show the updated esx-base VIB:

esx-base 5.1.0-0.5.838463 2012-09-12 Installed

Some additonal info can be found on:
ESXcli Software commands reference
The VMware Blog about VIBs