Check all articles
How to apply patches in VMware vSphere from the command line
If for some reason we can not update our host with the "Update Manager" of the "vCenter Server" and we need to do it manually. It is always recommended to perform a "Host Upgrade Baseline" from the Update Manager. Here is a guide on how to apply the patches from the command line, we should have some experience with Linux.
Important Note: Before installing the patch manually, turn off the virtual machines on the host to be updated.
Get the VMware version
The connection via ssh to the physical server (host) must be enabled. This can be done using: Direct Console User Interface (DCUI), the vSphere web client on the server (host) or also from the web client of the vCenter Server.
Connect using ssh with root user to the host, it can be with putty or the program of your choice, I use SSH Secure Shell Client.
Check the version of our VMware vSphere Hypervisor using:
#vmware -v
VMware ESXi 6.7.0 build-13473784
Download the patch
Verify in the VMware portal if there are patches available in the following link here, if you do not have an account you can create one ... it is free.
So, for example we have the patch with build number 13644319 published on May 14, 2019. Download it as indicated in the following image:
Copy the patch on the host
Check the storage disks you have available, if they have the capacity for the size of the patches:
#ls -l /vmfs/volumes
Put into physical disk with available space to save the patch:
#cd /vmfs/volumes/datastore1
Create a directory for your patches:
#mkdir PATCH_UPDATE
Enter in the directory:
#cd PATCH_UPDATE
In this directory copy the patches with ssh, with the disk administrator of vCenter Server or the web client of the host.
Apply the patch
Then, put the server in maintenance mode:
#vim-cmd /hostsvc/maintenance_mode_enter
Update with the new patch, it must be the full path of the file location:
#esxcli software vib install -d "/vmfs/volumes/datastore1/PATCH_UPDATE/ESXi670-201905001.zip"
Remove the maintenance mode:
#vimsh -n -e /hostsvc/maintenance_mode_exit
Restart the server:
#reboot
We can also put in maintenance mode and remove it respectively with the following commands, as an alternative to vim-cmd and vimsh:
#esxcli system maintenanceMode set --enable true
#esxcli system maintenanceMode set --enable false
And ready!!!
Do not forget to take a backup of the patches and remove them from your datastore.