How to Update ESXi 6.5 with Command Line

In a previous post I wrote about how to easily update ESXi 6.5 using Update Manager. This time I will show another method of updating ESXi, more specific I will update ESXi 6.5 with the command line tool (esxcli). This method works either the ESXi server is standalone or added to a vCenter Server (I will use no component of vCenter Server).

When is this method better than using the Update Manager? The simplest use case is when you have no vCenter Server (because Update Manager is a component of vCenter Server). In other cases, you may be more familiar running scripts than clicking into a user interface 🙂

As a prerequisite, I placed the ESXi server in maintenance mode. Let’s start!

Check ESXi Version

To find the current version of ESXi, after I connected with PuTTY to the server, I ran this command:

esxcli system version get

This shows me the current version, which in my case is ESXi 6.5.0 build 5310538. My target is to update this ESXi server to latest release which currently is ESXi 6.5.0 build 6765664, released on 4th October 2017.

Update ESXi - Check Current Version

By default, ESXi firewall blocks httpClient. I check if this is the case with this command:

esxcli network firewall ruleset list | grep httpClient

If it returns “true”, then the firewall is open, else we need to open it with the next command.

Update ESXi - Check Firewall Rule

To allow httpClient traffic to pass through the firewall, I ran:

esxcli network firewall ruleset set -e true -r httpClient

Update ESXi - Enable Firewall

To get a list of available versions from VMware site, I used this command to filter for ESXi 6.5.0:

esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep ESXi-6.5.0

My target release is listed as available under the name “ESXi-6.5.0-20171004001-standard”. This name is important, as I will need it later for the update command.

Update ESXi - Check Available Updates

 

Update ESXi version

It’s now time to run the update command:

esxcli software profile update -p ESXi-6.5.0-20171004001-standard -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

Please note I used in the command the ESXi version previously copied (ESXi-6.5.0-20171004001-standard).

Update ESXi - Start Update

The update will take few minutes to download and install the required packages. There is no update progress on the screen, in the end you will see a long list of updated vibs.

Update ESXi - Update Complete

As best practice, we need to disable the firewall rule we previously enabled:

esxcli network firewall ruleset set -e false -r httpClient

Update ESXi - Disable Firewall Rule

A reboot is required. Reboot the ESXi server and wait for it to be back available.

Verify ESXi Version

Now that the ESXi server is powered on, I connected back to SSH and re-ran the version command:

esxcli system version get

As expected, I see the my target version ESXi 6.5.0 build 6765664.

Update ESXi - Verify Update

Enjoy! Happy VM managing 🙂

Constantin Ghioc

I usually play with vSphere API, Ansible, vRealize Automation, vRealize Orchestrator, and different AWS tools. In my other life I’m a husband and a father, an amateur photographer and a Go enthusiast.

One thought to “How to Update ESXi 6.5 with Command Line”

  1. Thank you soo much for this awesome article. My ESXi 6.5 home server is up to date thanks to it.

    Fred

Leave a Reply