Let Me Upgrade You: Upgrading NetScaler via Terminal

A few months ago, I wrote about configuring NetScaler for ShareFile without using a GUI. Today, we’re going to take a look at upgrading NetScaler via terminal.

In all honesty, this post started as a joke back before I began blogging – and I have no idea why it’s taken me so long to find and post this material. A new release of NetScaler (release 12 build 41.16 – thought 41.22 is now out) was announced back in April of this year and I couldn’t wait to get my hands on it to test out new features and functionality.

I’m using a VPX that is local in our lab here – not necessarily the best, or fastest, environment to be working in. Most of the time, upgrades through the GUI fail or timeout, so I learned early on that using SCP and shell was the most efficient way to upgrade. The only problem was, nobody on my team knew how to do this, so I took to the Internet to find some answers. At the time, I didn’t find many posts out there detailing start to finish, so I used Citrix Docs and my good friend Google to help me learn some new scripting skills. (There may be, and most likely are, other posts on how to do this out there, but hey, what the heck – one more won’t hurt!)

The reason I say this came as a joke is because while I was going through the upgrade process, I received a text from a friend jokingly micromanaging me to ‘document my work.’ In response, I took screenshots and made directions for the upgrade process (very poorly and sarcastically documented, of course) and sent it over to him.

Little did I know that my team would find this information as helpful as they have. As a result of this little joke, I’ve had a number of colleagues use my ‘guide’ to upgrade their NetScalers and now I’ve decided to share it with a broader audience. So, here we go:

First things first, launch Terminal and SSH into your NetScaler:

ssh <user>@<NetScaler IP Address>

You’ll be prompted for a password for the specified user. Enter this and once authenticated, type “shell” to enter the shell:

shell

Once we are in the shell, let’s change directories to the install location by typing:

cd /var/install

This piece isn’t required, but I like to type “ls” to ensure the file isn’t already uploaded to the location.

Next, we’re going to create new directories for the release and the build that we will be upgrading to. We’ll start with the release and create another directory within it for the build:

mkdir <release number>nsinstall
cd <release number>nsinstall
mkdir <build>

We now have our destination folder for our updated release and we can exit the shell and NetScaler session or open a new Terminal window as we’ll need to go back into the NetScaler to extract and install our update.

Now we are going to use the SCP command to move the local file to our NetScaler – this is assuming that the new firmware package has been downloaded locally. To obtain the latest firmware, visit the Citrix Downloads page and log in to access the restricted download (accounts are free if you don’t have one already!).

In our new window or Terminal session:

scp: /<local build location>.tgz <user>@&<NetScaler IP Address>:/var/install/<release number>nsinstall/<build>

Here’s an example of how this should look with the information properly populated:

scp: /users/michaeldombroski/downloads/build-12.0-41.1_nc_32.tgz nsroot@<NetScaler IP Address>:/var/install/12nsinstall/build_41

Once the command is executed, you’ll be prompted for a password. Enter the password for the user that is specified in the SCP command and the firmware will begin uploading.

After the upload completes, let’s either log back into or go back to our existing NetScaler SSH session in Terminal and navigate to the build directory we created earlier (pick up where you left off below in the NetScaler):

ssh <user>@<NetScaler IP Address>
shell
cd /var/install/<release number>nsinstall/<build>

From here, if we type “ls”, we should see the newly uploaded firmware package!

Our next step is to unzip our bundled package. To do this, we use the following command:

tar xzvf <build>.tgz

In our unzipping command, we are giving the system some information about our package. The ‘x’ is letting tar know we are extracting the files, ‘z’ tells tar to decompress the file, ‘v’ is for verbose (list files one by one) and ‘f’ let’s the system know that we will specify the file (in this case, the build package) for the extraction and decompression.

Once the data is and ready for install, let’s install it!! From the current directory, type:

./installns

When prompted, reboot your NetScaler. On the next login, you should have your new build ready to go!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s