How to Install Jenkins in Rocky Linux(9.5)

To Install Jenkins on Rocky Linux 9.5

Introduction

Jenkins is a powerful application that facilitates continuous integration and continuous delivery of projects across various platforms. As a free and open-source tool, it is capable of managing a wide range of builds and continuous integration processes. Additionally, Jenkins can be integrated with numerous testing and deployment technologies. This tutorial will provide guidance on how to utilize Jenkins for the continuous building and testing of your software projects.

Procedure

Step 1: Check the OS Version

[root@localhost linuxhelp]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.5 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.5"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.5 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
VENDOR_NAME="RESF"
VENDOR_URL="https://resf.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.5"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.5"

Step 2: Add Jenkins Repository

[root@localhost linuxhelp]# wget -O /etc/yum.repos.d/jenkins.repo \
    https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2025-02-21 15:19:03--  https://pkg.jenkins.io/redhat-stable/jenkins.repo
Resolving pkg.jenkins.io (pkg.jenkins.io)... 151.101.158.133, 2a04:4e42:25::645
Connecting to pkg.jenkins.io (pkg.jenkins.io)|151.101.158.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85
Saving to: ‘/etc/yum.repos.d/jenkins.repo’
[root@localhost linuxhelp]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key

Step 3: Upgrade your Repository

[root@localhost linuxhelp]# dnf upgrade
Last metadata expiration check: 0:00:11 ago on Friday 21 February 2025 03:19:14 PM.
Dependencies resolved.
Nothing to do.
Complete!

Step 4: Install Java OpenJDK

[root@localhost linuxhelp]# dnf install java-17-openjdk.x86_64
Last metadata expiration check: 0:03:01 ago on Friday 21 February 2025 03:19:14 PM.
Dependencies resolved.
Complete!

Step 5: Install Jenkins

[root@localhost linuxhelp]# dnf install jenkins
Last metadata expiration check: 0:04:47 ago on Friday 21 February 2025 03:19:14 PM.
Dependencies resolved
Installed:
  jenkins-2.492.1-1.1.noarch                                                                                                           

Complete!

Step 6: Reload the System Daemon Service

[root@localhost linuxhelp]# systemctl daemon-reload

Step 7: Start & Enable Jenkins Service

[root@localhost linuxhelp]# systemctl start jenkins
[root@localhost linuxhelp]# systemctl enable jenkins
Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /usr/lib/systemd/system/jenkins.service.
[root@localhost linuxhelp]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; preset: disabled)
     Active: active (running) since Fri 2025-02-21 15:27:29 IST; 20s ago
   Main PID: 52071 (java)

Step 8: Add Firewall Permission for 8080 & http

[root@localhost linuxhelp]# firewall-cmd --zone=public --add-port=8080/tcp --permanent
success
[root@localhost linuxhelp]# firewall-cmd --zone=public --add-service=http --permanent
success
[root@localhost linuxhelp]# firewall-cmd --reload
success


Step 9: Browse your IP with Port Number 8080

Step 10: Copy the Password in given Location

[root@localhost linuxhelp]# cat /var/lib/jenkins/secrets/initialAdminPassword
682adaa29f2f48049e4fc4149c5edee2

Step 11: Install the Plugins

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Jenkins in Rocky Linux 9.5

Tag : Jenkins Java
FAQ
Q
What is a CI/CD pipeline?
A
CI/CD Pipeline or Continuous Integration/ Continuous Delivery is considered the DevOps approach's backbone. The pipeline is responsible for building codes, running tests, and deploying new software versions.
Q
How can we stop a scheduled job from being executed temporarily?
A
Disable the job from the job details page to temporarily stop all scheduled executions & other factors/events from triggering the job and enable it back to resume the job schedules/triggers. If a job is not required permanently, we can delete the job from the jobs list view page.
Q
What are the types of Jenkins pipelines?
A
Jenkins Pipelines can be either - a Declarative pipeline or a Scripted Pipeline. Declarative pipeline makes use of numerous, generic, predefined build steps/stages (i.e. code snippets) to build our job according to our build/automation needs whereas, with Scripted pipelines, the steps/stages can be custom-defined & used using a groovy syntax which provides better control & fine-tuned execution levels.
Q
What are the common use cases Jenkins is used for?
A
Jenkins being open-source automation can be used for any kind of software-based automation. Some of the common use cases include but are not limited to
• Software build jobs
• Sanity/Smoke/CI/Regression test jobs
• Web/Data Scraping related jobs
• Code coverage measurement jobs
• General-purpose automation
• Reverse Engineering jobs
• Key Decoding jobs & many other jobs where software automation will be applicable.
Q
What is Continuous Integration?
A
Continuous Integration (CI) is a development practice in which developers commit changes to the source code in a shared repository at regular intervals. Every commit made in the repository is then built. This allows the development teams to detect problems early.
Continuous integration requires the developers to have regular builds. The general practice is that whenever a code commit occurs, a build should be triggered.