Thursday 8 March 2018

Updating ESXi via command line

A colleague of mine wanted to update their standalone ESXi home lab server and wanted to know what quick way there is to do it.  The method I am going to describe is just for minor version update ie from U1 to U2 and not for major updates such as 6.0 to 6.5.

The method we are going to use is an esxcli command to do the update. The first step is to download the "offline bundle" from my.vmware.com
Below I will describe a few different ways to update your ESXi host depending on your preferences and settings. 

The command that we would be using throughout the article is
esxcli software vib install -d %SourcePath%

Method 1 : Upload offline bundle (.zip) to a datastore where the ESXi host has access to 

Option a) Ensure SSH access is allowed to the host otherwise enable it first. SSH to the ESXi host and then run the command as described above, eg
esxcli software vib install -d "/vmfs/volumes/datastore1/update-from-esxi6.5-6.5_update01.zip"

Option b) If SSH is not enabled on the host or you don't want to then you can use PowerCLI instead and the commands would be 
connect-viserver Your_ESXi_IP_Or_FQDN
Set-VMhost -State Maintenance
$esxcli = Get-EsxCli -v2
$esxcli.software.vib.install.Invoke(@{depot="Path_To_ZIP_File"})
restart-vmhost
The above commands will login to you ESXi host. Place the host in to maintenance mode, use EsxCli in Powershell, execute esxcli command to install update and then reboot the host. In the above command replace "Your_ESXi_IP_Or_FQDN" with your ESXi host details and "Path_To_ZIP_File" with the location of your zip eg
$esxcli.software.vib.install.Invoke(@{depot="/vmfs/volumes/datastore1/update-from-esxi6.5-6.5_update01.zip"})

Method 2 : Host the update files on a web server where your ESXi host has access to. You will need to unzip the offline bundles and share those out. I used hfs from the article I written to be able to quickly setup a webserver to share those files. Make sure you do not change the structure of the extracted files

Option a) Ensure SSH access is allowed to the host otherwise enable it first. SSH to the ESXi host and then run the command as described above, eg
esxcli software vib install -d "http://192.168.88.14/update-from-esxi6.5-6.5_update01/"

Option b) If SSH is not enabled on the host or you don't want to then you can use the same PowerCLI commands as above in Method 1, option B changing the depot path to something similar as below
$esxcli.software.vib.install.Invoke(@{depot="http://192.168.88.14/update-from-esxi6.5-6.5_update01/"})

As you can see there are a few quick easy ways to update a standalone host for your lab environment if you need to. 

No comments:

Post a Comment

New Azure KMS IP and domain Addresses for activation

For Windows virtual machines deployed into Azure using marketplace images you may have created rules in your NSG or firewalls to allow the s...