0
0
Jenkinsdevops~5 mins

Jenkins versions and LTS - Commands & Configuration

Choose your learning style9 modes available
Introduction
Jenkins is a tool that helps automate software building and testing. It has different versions, including Long-Term Support (LTS) versions that are more stable and updated less often. Choosing the right version helps keep your automation reliable and secure.
When you want a stable Jenkins setup that changes less often and is tested thoroughly.
When you need the latest features and improvements Jenkins offers quickly.
When you want to avoid unexpected issues by using a version with long-term support.
When planning upgrades and want to minimize downtime by using LTS versions.
When running production pipelines that require maximum reliability.
Commands
This command shows the current Jenkins version installed on your system to verify which version you are running.
Terminal
jenkins --version
Expected OutputExpected
2.387.1
This command fetches the latest Jenkins LTS version number from the official Jenkins update site.
Terminal
curl -s https://updates.jenkins.io/stable/latestCore.txt
Expected OutputExpected
2.387.1
This command fetches the latest Jenkins weekly (non-LTS) version number from the official Jenkins update site.
Terminal
curl -s https://updates.jenkins.io/current/latestCore.txt
Expected OutputExpected
2.414
This command installs a specific Jenkins LTS version (2.387.1) on a Debian-based system to ensure stability.
Terminal
sudo apt-get install jenkins=2.387.1
Expected OutputExpected
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: jenkins 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/100 MB of archives. After this operation, 500 MB of additional disk space will be used. Selecting previously unselected package jenkins. (Reading database ... 123456 files and directories currently installed.) Preparing to unpack .../jenkins_2.387.1_all.deb ... Unpacking jenkins (2.387.1) ... Setting up jenkins (2.387.1) ... Processing triggers for systemd (245.4-4ubuntu3.13) ...
=2.387.1 - Specifies the exact Jenkins version to install
This command checks if the Jenkins service is running after installation.
Terminal
systemctl status jenkins
Expected OutputExpected
● jenkins.service - Jenkins Continuous Integration Server Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2024-06-14 10:00:00 UTC; 1min 30s ago Main PID: 1234 (java) Tasks: 50 (limit: 4915) Memory: 300.0M CGroup: /system.slice/jenkins.service └─1234 /usr/bin/java -jar /usr/share/jenkins/jenkins.war
Key Concept

If you remember nothing else from this pattern, remember: Jenkins LTS versions provide a stable and tested environment ideal for production, while weekly versions offer the latest features but change more often.

Common Mistakes
Installing the latest weekly Jenkins version in a production environment without testing.
Weekly versions may have new features but can introduce bugs or instability.
Use the latest LTS version for production to ensure stability and reliability.
Not checking the installed Jenkins version before upgrading.
Upgrading blindly can cause compatibility issues with existing plugins or pipelines.
Always check the current version with 'jenkins --version' and review release notes before upgrading.
Using generic install commands without specifying the version.
This installs the latest version, which might not be the desired LTS or stable release.
Specify the exact version number during installation to control which Jenkins version is installed.
Summary
Use 'jenkins --version' to check your current Jenkins version.
Fetch the latest LTS or weekly version numbers from Jenkins update URLs to decide which to install.
Install Jenkins with a specific version to ensure stability, especially in production.
Verify Jenkins service is running after installation with 'systemctl status jenkins'.