Pages

Selasa, 01 Mei 2012

Upgrading ESXi using the command line

Takeaway: Since not everyone has clusters set up, or even have vCenter, Lauren Malhoit shows you a way to upgrade ESXi using the command line.

I wrote a post recently about upgrading to vSphere 5.0 u1 using Update.  However, not everyone has clusters set up, or even vCenter for that matter.  I have just that scenario at a test site that has only one ESXi server and is also remote.  For the ESXi server at this site I decided to use esxcli to update this server using vCLI (which can be downloaded here.) Now this update cannot be done without outages, but in a test site, that becomes less important.

There is some terminology that you should be familiar with before doing this.  A VIB is an ESXi software package (such as an update to 5.0 u1) that can be found in a Software Depot.  A Software Depot is kind of like a repository for VIBs and Image Profiles.  An Image Profile is an ESXi image that consists of VIBs.  It always includes a base VIB, along with other VIBS.  You can edit the image profile using image builder.  These definitions were taken from the VMware website.  I’ll use VIBs and my own software depot (which basically means that I uploaded the VIB to a datastore on my network, more on that later).  Similar actions can be done using an Image Profile as with a VIB, but in this post I will only concentrate on the use of VIBs.
As I said before, you’ll need vCLI or the vSphere Management Assistant to update the ESXi server using esxcli commands.  Here are the steps I followed to do the update:
  1. After downloading vCLI go to Start>>All Programs>>VMware>>VMware vSphere CLI and open it.
  2. Download the ESXi 5.0 Update1 Offline Bundle (VIB) from VMware.com/patchmgr/findpatch.portal
  3. Upload this VIB to a datastore that the host can communicate with and take note of the location to which you upload it.  Leave it in the .zip format as there is no need to extract the files.  This can be done using SCP, or WinSCP, or using the vSphere client.
  4. Now use the vSphere client to connect directly to the host and shutdown any running VMs.
  5. Place the host in Maintenance Mode.
  6. Type “esxcli –Server=[fqdn of esxi host] software sources vib list –depot=/vmfs/volumes/[name of datastore you uploaded the VIB to]/[name of update; ex: update-from-esxi5.0_5.0_update01.zip]” (without the quotes) to list the VIBs available in your depot, which is actually the datastore you uploaded your VIB to.
  7. Now type “esxcli –Server=[fqdn of esxi host] software vib update –depot=/vmfs/volumes/[name of datastore]/[name of update].  This may take a couple of minutes to return a response, but eventually you should get a message that says “The update completed successfully, but the system needs to be rebooted for the changes to be effective.”  After that it will list the VIBs that were installed, removed, and skipped.
  8. Go back to the vSphere Client that is directly connected to the ESXi host and right-click on the host and select reboot.  This can be done using the command line as well, but this is probably easier for us GUI lovers.
  9. Let that run for a few minutes.  You may need to disconnect and reconnect your vSphere client to see any changes.
  10. When the reboot is complete you may turn on any VMs that you turned off at the beginning of this process.
  11. Once you are connected again, highlight the ESXi server in the vSphere client and look at the top of the main pane (above the tabs) to confirm that the build number has updated to the proper update.
That’s all there is to it.  It’s a simple upgrade.  It’s also good to get familiar with the command line, as it may be more efficient and even necessary to use at times.  Although I used vCLI to do my upgrade, the same commands can be used with the vMA and the vMA can offer some advantages to working with the ESXi hosts in general.  However, the vMA is an actual appliance that would need to be turned off if you only have one ESXi server available and no other host to migrate it to while doing the upgrade.