Upgrade to VMware vSphere ESXi 6.7 Update 2 with Command Line
![Upgrade-to-VMware-vSphere-ESXi-6.7-Update-2-with-Command-Line](https://www.virtualizationhowto.com/wp-content/uploads/2019/04/Upgrade-to-VMware-vSphere-ESXi-6.7-Update-2-with-Command-Line.png)
One of the great things about ESXi from a lifecycle management and update perspective is you have multiple ways to do things. As administrators, we want to have options for various scenarios. As posted in the previous post covering the new vSphere Update Manager features in vSphere 6.7 Update 2, VMware is continuing to make the VUM functionality more fully featured and better with each release of vSphere. However, at times you may have the need to update ESXi from the command line. This is easily done and there are various tools you can use to update/upgrade ESXi to the latest versions or even a specific ESXi profile. Let’s take a look at how to Upgrade to VMware vSphere ESXi 6.7 Update 2 with command line and see how this is accomplished.
VMware ESXi Update Profiles
The Update of VMware ESXi from the command line is performed based on ESXi Image Profiles. I really like this approach to updating ESXi. It is basically like a desired state that you set and the update from the command line looks at desired Image Profile and then installs the updates/upgrades required to bring the ESXi host up to that Image Profile version. So you as the administrator aren’t left with the task of figuring out which exact patches to install from the command line. All you need to know is the Image Profile to pass along to the commands. Again, it is a very efficient and powerful approach to updating ESXi from the command line.
What if you have a specific build version that you want to get to, but you do not know the Image Profile associated with that specific build? Virten.net has a great resource here for keeping track of the Image Profiles that correspond to specific build versions. I reference this site often for the build versions, etc. Check it out here:
https://www.virten.net/vmware/vmware-esxi-image-profiles/
VMware ESXi Command Line Tools for Getting Version and Profile Info
The ESXi esxcli command line tool provides really great commands to determine the specific system version of your current ESXi server as well as the current profile if you want that information as well.
To get the specific version of the ESXi server, use the following command:
esxcli system version get
To get the ESXi Image Profile, use the following command:
esxcli software profile get
Upgrade to VMware vSphere ESXi 6.7 Update 2 with Command Line
The process to upgrade to VMware vsphere ESXi 6.7 Update 2 with Command Line is very straightforward. This is accomplished with a few commands. The first thing that needs to be done is to allow the ESXi host out to the Internet to pull down the required patches. To do that, use the following command:
esxcli network firewall ruleset set -e true -r httpClient
Now you will want to place the host into maintenance mode. You can do this from the command line with the following commands:
vim-cmd /hostsvc/maintenance_mode_enter
vimsh -n -e /hostsvc/maintenance_mode_exit
Once you have the Image Profile for the ESXi version you want to upgrade/update to and the host is in maintenace mode, it is simply a matter of running the command for the upgrade. This is accomplished by running the following esxcli command:
esxcli software profile update -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml -p ESXi-6.7.0-20190402001-standard
As a side note, if you want to search for or see the available Image Profiles with the esxcli command, you can use the following:
esxcli software sources profile list -d https://hostupdate.vmware.com/software/VUM/PRODUCTION/main/vmw-depot-index.xml | grep ESXi-6.7.0
This will search for and display the image profiles available for 6.7.0 versions which can be a good way to see what is available if you don’t have access to query the latest image profiles by another means.
Wrapping Up
Upgrading a VMware ESXi host from the command line is easily accomplished and provides a really great and easy way to upgrade ESXi hosts to a specific Image Profile. This is especially useful if you have a standalone ESXi host or need to upgrade a host to a specific version. Using the above commands it is a simple matter of deciding on the Image Profile, allowing HTTP connectivity, placing the host in maintenance mode, and then running the update.