How to Upgrade Jenkins on Windows/Linux Server

Yann Mulonda
Geek Culture
Published in
4 min readNov 3, 2022

Intro to Jenkins CI Tool

Quick Intro

Jenkins is an open-source automation server also known as a Continuous Integration Tool. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery.

If you are not familiar with the concept behind Continuous Integration, Delivery, or Deployment; I’d recommend you read my article on How to Set Up Continuous Integration & Delivery (CI/CD).

Tips & Recommendations

* For best pratcice of life cycle managament, I’d recommend upgrading your Jenkins instance to the latest LTS version 4 times per year or every quarter. Long-Term Support (LTS) release baselines are chosen every 12 weeks from the stream of regular releases. Every 4 weeks we release stable releases which include bug and security fix backports.

* Beginning with Jenkins 2.357 (released on June 28, 2022) and the forthcoming September LTS release, Jenkins requires Java 11.

* Additionally, beginning with Jenkins 2.355 (released on June 14, 2022) and Jenkins 2.346.1 LTS (released on June 22, 2022), Jenkins supports Java 17.

* Plugins have already been prepared in JENKINS-68446. Use the Plugin Manager to upgrade all plugins before and after upgrading to Jenkins 2.357.

Downloading Jenkins

Jenkins is distributed as WAR files, native packages, installers, and Docker images. In this article, I’m going to share my input on how to upgrade your Jenkins Instance using the WAR file. This Jenkins WAR file can be found here.

  1. Before downloading, please take a moment to review the Hardware and Software requirements.
  2. Select one of the latest LTS version WAR packages and follow the download instructions.
  3. Once a Jenkins package has been downloaded, proceed to the Installing Jenkins

Upgrading Jenkins

The procedures in this article are for an upgrade of an existing Jenkins instance using the WAR packages.

image source: digitalvarys.com
  • Jenkins is typically run as a standalone application in its own process with the built-in Java servlet container/application server (Jetty).
  • Jenkins can also be run as a servlet in different Java servlet containers such as Apache Tomcat or GlassFish.

However, instructions for setting up these types of installations are not covered in this article.

Upgrade implementation steps on Windows

The process of upgrading a Jenkins instance running on a Windows server is very straightforward:

  1. Go to services and stop the Jenkins service
  2. Go to the location where your Jenkins instance is installed
  3. → Rename the war folder to war.old
  4. → Rename jenkins.war file to jenkins.war.old
  5. Copy the new jenkins.war you downloaded into your Jenkins installation directory
  6. Start Jenkins service
  7. → Observe the creation of a new war directory which will now contain the contents of the new jenkins.war archive

Navigate to Jenkins's home page, at which point you will be informed that Jenkins is preparing your installation. Once complete, test your existing jobs to verify compatibility

Upgrade implementation steps on Linux

1. Stop Jenkins service

#Stop running Jenkins service using the following command:sudo su -
service jenkins stop

2. Take Jenkins instance Backup as a recovery option

#Take backup of Jenkins home directory. In my case my Jenkins home directory is /var/lib/jenkins.cd /var/lib
tar -cvzf jenkins_date.tar.gz jenkins/
mv jenkins_date.tar.gz $HOME

3. Take The Backup Of the Current Jenkins Version Binary

#Take the backup of Jenkins current version binary using following commands:cd /usr/share/jenkins
mv jenkins.war jenkins.war.old

4. Download The New LTS Jenkins Version

#Download the new version of Jenkins WAR file using the following commands:wget https://updates.jenkins-ci.org/latest/jenkins.war

5. Start The Jenkins Service

#Start the Jenkins service using the following command:

service jenkins start

Troubleshooting Plugins issues

It might happen that Jenkins start-up but with multiple exceptions errors on the Jenkins web page.

  • Start by looking into the Jenkins log files

In most cases, to address this:

  1. Stop Jenkins service
  2. → Rename the config.xml file to config.xml.old — which will disable authentication and other configurations.
  3. Start Jenkins service → a new config file will be created
  4. Jenkins will start without the login page → Go to Manage Plugins and update all the plugins
  5. Go back to the server → stop Jenkins service
  6. → Rename the current config.xml file that was created to config.xml.new
  7. → Rename your initial customed config.xml.old file to config.xml
  8. Start Jenkins service — this should bring up the Jenkins page with everything working as expected

Post upgrade tasks

  • After the upgrade, log in to Jenkins UI and verify that you see the new version number at the bottom right corner.
  • Navigate to ‘Manage Jenkins’ via the menu and Action any notifications displayed — plugins, data format conversions, etc.
  • After a couple of days of everything working as expected → Delete jenkins.war.bak file and war.bak folder

If you liked this article, you might also like; How to install/Update OpenJDK on Jenkins

Cheers!!

--

--

Yann Mulonda
Geek Culture

Co-Founder & CIO @ITOT | DevOps | Senior Site Reliability Engineer @ICF󠁧󠁢󠁳󠁣󠁴 | "Learning is experience; everything else is just information!”