Tuesday, September 18, 2012

A Pretty Cool Method of Upgrading to ESXi 5.1

I recently came across an interesting article by Andreas Peetz which shows you how to patch an ESXi host using an image profile that is directly available on VMware's online depot within the ESXi shell. I knew that VMware had online depots for use with VUM and Auto Deploy but I was not aware of this particular method, especially directly from the host.

Disclaimer: This method assumes you can install the default ESXi Image Profile with no additional drivers or packages, else you may have connectivity issue after the upgrade. If you still need to customize the ESXi Image Profile before installation, you will still need to use something like Image Builder and then upload that to your online depot.

Note: There are many ways that you can patch/upgrade your ESXi hosts, here is another article that provides more details for command-line only methods.

Before you get started, you will need to make sure that your ESXi host has the httpClient firewall rule enabled, else you will not be able to connect to VMware's online depot. To enable this, run the following ESXCLI command:
esxcli network firewall ruleset set -e true -r httpClient
Also make sure that your ESXi host can reach the following URL (you can specify a proxy if needed):
https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

To view the available ESXi Image Profiles, run the following ESXCLI command (use the --proxy if you need to specify a proxy to reach VMware's online depot):
esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
If you are able to successfully connect to the online depot, you see a list of all the ESXi Image Profiles that are available to you. You will see two ESXi 5.1 Image Profiles (these were recently published), one with VMware Tools and one without VMware Tools.

Note: Before you begin, make sure you do not have any running VMs and put your host into maintenance mode.

Let's go ahead and upgrade our ESXi 5.0 Update 1 host to latest ESXi 5.1. To install the new Image Profile, run the following command:
esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-5.1.0-799733-standard
This can take a few minutes to complete depending on how fast you can pull down the Image Profile. Once it is done, you will see all the new VIBs that have been updated and you will be asked to reboot for the changes to go into effect and then you will be running ESXi 5.1! Pretty cool IMO!

17 comments:

  1. I saw that on the release notes (https://www.vmware.com/support/vsphere5/doc/vsphere-esx-vcenter-server-51-release-notes.html#upgrading) and found that really cool too :)

    "You can upgrade and apply patches to ESXi 5.0.x hosts by using the esxcli command-line utility for ESXi to install ESXi 5.1 from a download depot on vmware.com or from a downloaded ZIP file of a depot that is prepared by a VMware partner."

    ReplyDelete
  2. I needed to add --ok-to-remove to my command line because the host had an older host profile to get the update going.

    ReplyDelete
  3. William you rock dude. Thanks for the cool post

    ReplyDelete
  4. Hello, william!
    i´m using ESXi5 (free version of VMware vSphere Hypervisor 5 on a Acer AC100 with 16Gig RAM) and try to update my existing server. The standard method using

    esxcli software vib update –depot /vmfs/volumes/4f2aad46-***/ESXi500-201207001.zip

    finished with the errors: "VIB .... cannot be removed live"

    ESXi is running in maintenence mode.

    Glad to see your blog with another method to upgrade, I got the same errors.

    Do you have any suggestions, how to continue the update ?

    Chris
    Vienna

    ReplyDelete
  5. ESXi free edition is read-only through cli that's maybe why

    ReplyDelete
  6. I'm getting the "cannot remove live" that Anonymous got... but its not the free edition...

    ReplyDelete
    Replies
    1. @Anonymous,

      Can you try "--ok-to-remove" as noted by @David Barker?

      Delete
  7. Great post!

    With Nexus 1000v

    ~ # esxcli software profile install -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-5.1.0-799733-standard
    [Exception]
    You attempted to install an image profile which would have resulted in the removal of VIBs ['Cisco_bootbank_cisco-vem-v142-esx_4.2.1.1.5.1a.0-3.0.1']. If this is not what you intended, you may use the esxcli software profile update command to preserve the VIBs above. If this is what you intended, please use the --ok-to-remove option to explicitly allow the removal.
    Please refer to the log file for more details.
    ~ #

    ReplyDelete
  8. Thank you :) ... this helped alot !!!

    ReplyDelete
  9. I know this is an older posting (earlier this year) but it absolutely rocked and is not only a different way to upgrade but an awesome way to upgrade. Worked flawlessly on my ESXi box (SH67H3) after struggling with some other methods. It took a while... but when it completed... all was golden. Thanks again.

    ReplyDelete
  10. TNX works like a champ :D save me a lot of time

    ReplyDelete
  11. This was my first shot at patching my first ESXi box and it was flawlessly! This is an all-in-one home NAS box, so I guess it's the free version. Took about 1 minute after entering three lines:

    - Place ESXi into maintainence mode
    - run VMware vSphere CLI

    >>> esxcli -s network firewall ruleset set -e true -r httpClient
    >>> esxcli -s esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml

    - find the latest patch in the list and copy the name (i.e. ESXi-5.1.0-20121201001s-standard)

    >>> esxcli -s software profile install -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-5.1.0-20121201001s-standard

    Thanks!

    ReplyDelete
  12. Sorry, try again:

    # esxcli -s (ip) network firewall ruleset set -e true -r httpClient
    # esxcli -s (ip) software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml
    # esxcli -s (ip) software profile install -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-5.1.0-20121201001s-standard

    ReplyDelete
  13. No third party apps
    esxcli software profile install -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-5.0.0-20121202001-standard

    Clobber third party apps
    esxcli software profile install --ok-to-remove -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-5.0.0-20121202001-standard

    Don't clobber third party apps
    esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-5.0.0-20121202001-standard

    ReplyDelete
  14. Worked like a charm on my free edition whitebox build! A ton easier than burning an ISO.

    ReplyDelete
  15. Does the command applies to ESXi 5.1 Update 1?

    ReplyDelete