How To Upgrade Jenkins Version on Linux OS
In this article, We are going to see the important locations of Jenkins and How to upgrade of the exits Jenkins server.
If you are new to the Jenkins so you can refer to my last article which on Installation of Jenkins.
This article is divide into the following 2 parts
- Jenkins Server File Hierarchy
- Upgrade The Jenkins Server
So lets start with the first part Jenkins server file hierarchy. In this part we are going to see the important files and directory’s of Jenkins server.
Jenkins Server File Hierarchy
First, we are going to check the home directory of our Jenkins.
grep jenkins/etc/passwd | cut -d: -f6
In my case the Jenkins home directory is /var/lib/
Important Jenkins files and directory’s in Linux
- /usr/share/jenkins – In this location Jenkins binary jenkins.war file is stored.
- /var/log/jenkins – In this location Jenkins logs are stored.
- /var/lib/jenkins – This is an important directory of Jenkins. This directory contains all the details related Jenkins. In this directory it will stored jobs, workspace, users, nodes details, plugins and job configurations.
- /run/jenkins – This directory contains PID of currently running Jenkins.
Upgrade The Jenkins Server
Step 1: Stop The Running Jenkins Server
For Jenkins version upgrade, We need to stop running Jenkins service using the following command
sudo systemctlstop jenkins//For SystemD Based Linux OR sudoservice jenkinsstop //For Init Based Linux
Step 2: Take Jenkins Server Backup For Safety
Already I explained the important directors of Jenkins Server in this article. We just need to take backup of
cd/var/lib tar- cvzfjenkins_date .tar . gz jenkins/ // You can specific backup date mvjenkins_date .tar . gz$HOME
Step 3: Take The Backup Of Current Jenkins Version Binary
Now it’s time to take the backup of
cd /usr/share/jenkins sudo mv jenkins.war jenkins.war.old
Step 4: Download The New Jenkins Version
We are downloading new version of Jenkins using the following commands
sudo wget https://updates.jenkins-ci.org/latest/jenkins.war
Step 5: Change The Ownership Of New Jenkins Binary
We need to change the ownership of new Jenkins binary using following command
sudo chown root:root jenkins.war
Step 6: Start The Jenkins Server
Now it’s time to start the Jenkins server using the following command
sudo systemctlstart jenkins//For SystemD Based Linux OR sudoservice jenkinsstart //For Init Based Linux
Step 7: Check The Jenkins Version
We need to check the Jenkins version using the following command
cat/var/lib/ jenkins/config.xml | grep'<version>'
Congratulations! You successfully upgrade the Jenkins.