Step-by-Step Guide to Installing and Upgrading Jenkins on Linux

This guide provides a comprehensive walkthrough for installing and upgrading Jenkins on Linux systems. Whether you're using Ubuntu, Debian, or RHEL-based distributions, you'll find detailed instructions to help you set up Jenkins efficiently. Follow along to ensure a smooth installation and upgrade process, tailored to your specific Linux environment.
https://www.jenkins.io/doc/book/installing/linux/#red-hat-centos
sudo su -
yum install wget -y
wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
yum upgrade
# Add required dependencies for the jenkins package
yum install fontconfig java-17-openjdk
yum install jenkins -y
systemctl daemon-reload
systemctl enable jenkins
systemctl start jenkins
systemctl status jenkins
Upgrade Jenkins to a Specific Version on Linux
To upgrade Jenkins to a specific version on Ubuntu/Debian or RHEL-based distributions, follow these steps:
Check Current Jenkins Version
Before upgrading, check the currently installed version and Stop Jenkins
jenkins --version
systemctl status jenkins | grep Active
sudo systemctl stop jenkins
To find the jenkins.war file location:
sudo find / -name "jenkins.war"
Example Output
/usr/share/jenkins/jenkins.war
/opt/jenkins/jenkins.war
This means the jenkins.war file is present in two locations.
1.Stop Jenkins
sudo systemctl stop jenkins
2.Backup the existing jenkins.war
sudo mv /usr/share/jenkins/jenkins.war /usr/share/jenkins/jenkins.war.bak
3.Download the specific/stable version:
If you want a specific version, replace latest in the URL with the version number:
https://updates.jenkins.io/download/war/ (Right click copy link address)
wget -O /usr/share/jenkins/jenkins.war https://get.jenkins.io/war-stable/2.375.2/jenkins.war
- Restart Jenkins
sudo systemctl start jenkins
sudo systemctl restart jenkins
Check the version again
jenkins --version
conclusion : installing and upgrading Jenkins on Linux systems can be a straightforward process when following the right steps. By carefully checking the current version, stopping Jenkins, backing up existing files, and downloading the desired version, you can ensure a smooth transition. Whether you're using Ubuntu, Debian, or RHEL-based distributions, these guidelines will help you maintain an efficient and up-to-date Jenkins environment, supporting your continuous integration and delivery needs effectively.
Subscribe to my newsletter
Read articles from kv kulakarrni directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
