Upgrade Jenkins server to a new version

It is very critical to keep Jenkins up-to-date with the latest version for security purposes. For production environment, you should always use LTS releases which are long term releases and stable in nature. One should always go through the detailed documentation and changelog related to the newer release. Same can also be found online at https://jenkins.io/doc/upgrade-guide/. Needless to say, you should always backup your jenkins environment before upgrading.

In this tutorial, we’ll discover how to upgrade the Jenkins to a newer version. These steps are for the CentOS 7 version but can be easily translated to other linux distros.

Identify Current Jenkins Version

To identify the current version of Jenkins, we can do one of two things. From the Jenkins UI console, if we look at the bottom right corner, we’ll see the current version of the Jenkins that we are running:


Or, login to the Jenkins server, and use the jenkins-cli.jar and execute the following to get the current version from the command line.

java -jar jenkins-cli.jar -s http://localhost:8080/ version

When we login to Jenkins UI console, and click on “Manage Jenkins” menu item, if we need an upgrade, it will display the following message at the top saying that a new version of Jenkins is available for download:

Upgrade notification for Jenkins.JPG
Upgrade notification for Jenkins

Upgrade Jenkins using yum repository

Note: If one has installed Jenkins as part of yum install, then one should run:

sudo yum update jenkins

which will upgrade the war file accordingly.

Also, if one has previously installed Jenkins using yum, but yum repository still doesn’t have the latest version of Jenkins, he/she can still go ahead, download the war file and upgrade it manually as explained in this blog post.

Eventually when the repository catches up with the latest version, one can always do sudo yum update jenkins at that time.

Download New Jenkins war File

If we click on the download link from the above message, it will not download the whole Jenkins Installer. Instead, it will download only the jenkins.war file.

We can just copy the link to download from your Jenkins UI console, and go to command prompt, and use wget to download the war file:

cd downloads/
wget http://updates.jenkins-ci.org/download/war/2.32.2/jenkins.war

Replace your version no of Jenkins in the above command.

Install the new Jenkins war file

On the server, jenkins.war file is located under /usr/lib/jenkins directory. Before wecopy the new version of the jenkins war file, we need to take a backup of the existing version of jenkins war file:

cp /usr/lib/jenkins/jenkins.war /downloads/jenkins.war.previous.version

Now, copy the newly downloaded war file to the /usr/lib/jenkins directory.

cp /downloads/jenkins.war /usr/lib/jenkins/

After this, restart the Jenkins service as shown below:

sudo systemctl stop jenkins
sudo systemctl start jenkins

To make sure service is running, try running sudo systemctl status jenkins after a few minutes and we should see below output:

 jenkins.service - LSB: Jenkins Continuous Integration Server
 Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
 Active: active (running) since Wed 2017-02-15 04:03:13 EST; 59s ago
 Docs: man:systemd-sysv-generator(8)
 Process: 59694 ExecStop=/etc/rc.d/init.d/jenkins stop (code=exited, status=0/SUCCESS)
 Process: 59739 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)
 CGroup: /system.slice/jenkins.service
 └─59758 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.wa...


Well, now we can login into UI console and make sure that everything is working alright.

6 thoughts on “Upgrade Jenkins server to a new version

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 )

Facebook photo

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

Connecting to %s