Patching and Upgrading ESXi using ESXCLI commands20 Jul 2016 by 4
In this post I’ll show you how to install patches and upgrade ESXi hosts using esxcli commands. I’ll start first by installing a bug fix patch followed by an ESXi OS version upgrade using what’s called an offline bundle. The latter is particularly useful when you don’t have vSphere Update Manager deployed in your environment.
For this demo I’ll be using WinSCP which, among other things, is used to upload files such as vib packages to an ESXi’s file-system. For this to work, you need SSH enabled on the ESXi host making sure port 22 is not being blocked en route. I’ll use putty to ssh to the ESXi host.
Installing a patch
There are 6 steps you need to follow when installing patches on ESXi
Step 1 – Download the patch. I’ve chosen to download a bug fix as described in KB214164. You’ll see this patch selected in Figure 1.
Step 2 – Upload the patch to the ESXi host using WinSCP or similar. You can also use the vSphere client by browsing the datastore and using the upload button
I do however prefer the former method since it gives you more control over where to place the uploaded file and allows you to resume broken or paused uploads. Using WinSCP could not in fact be any easier. Just create a new connection by supplying the ESXi IP address and credentials. Then just drag the file from the source folder (left hand pane) to the destination folder (right hand pane). Figure 3 shows the process of copying a patch from a local folder to one created on a datastore.
Step 3 – Establish an SSH connection using something like putty.
Step 4 – Place the host in maintenance mode
You can do this from the vSphere client but since we’re using command line, let’s use;
Step 5 – Install the patch
This is where we use the esxcli software vib command to install the patch. This step warrants some more detail. The esxcli software vib command takes on two installation parameters these being update and install. The difference between the two is important since update DOES NOT overwrite existing files with a higher version than those being installed. The install parameter on the other hand doesn’t really care and bulldozes its way through overwriting conflicting files regardless of version. Bottom-line is, be very careful when you use the install option. To be on the safe side, it’s a good idea to refer to any KB article released for the patch or update in question. For further information make sure to check this out.
For this example, I’m using the command below to apply the patch previously downloaded. The path specified the -d parameter will, of course, vary according to the datastore or folder to which you copied the update file. Keep in mind also that you must specify the full path to the patch or update that you wish to install.
esxcli software vib update -d "/vmfs/volumes/55fbd499-7588730f-f5a1-005056b87047/ESXi550-201601001.zip"
If all goes according to plan, you should see something similar to the output in Figure 5.
Step 6 – Take the host out of maintenance mode and reboot it if prompted to do so.
The video coming up next illustrates the whole process from start to finish.
Upgrading ESXi using an offline bundle
I’m basically going to repeat the same steps as above except that this time, I’ll use the install option instead of update to upgrade ESXi. This method requires you to download a so called ESXi offline bundle (see Figure 7).
In the video that follows, I skipped the part where you upload the file to the host jumping directly to the upgrade part. As you’ll see shortly, the vmware –v command lets you display the version information before and after the upgrade process.
Manually patching and upgrading ESXi hosts isn’t that much of a deal, as we have just seen. In some ways it’s even easier than using vSphere Update Manager (VUM) although I still think that VUM is the way to go when patching up a significantly large number of hosts.
That’s all I have for you today. I hope you enjoyed reading the article and found its contents interesting as well as useful.
Have any questions or feedback?
Leave a comment below!