How To Install Jenkins On Rocky Linux 8.6

To Install Jenkins On Rocky Linux 8.6

Introduction

Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes and also used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build.

Step 1 : Checck the installed version of OS by using the below command

[root@linuxhelp ~]# cat /etc/os-release 
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.6 (Green Obsidian)"

Step 2 : Install java package by using the below command

[root@linuxhelp ~]# yum install java-11-openjdk-devel -y
Rocky Linux 8 - AppStream                                         5.9 MB/s | 8.8 MB     00:01    
Rocky Linux 8 - BaseOS                                            1.8 MB/s | 2.7 MB     00:01    
Rocky Linux 8 - Extras                                            9.7 kB/s |  11 kB     00:01    
Dependencies resolved.
==================================================================================================
 Package                     Arch      Version                                 Repository    Size
==================================================================================================
Installing:
 java-11-openjdk-devel       x86_64    1:11.0.15.0.10-2.el8_6                  appstream    3.4 M
Installing dependencies:
 copy-jdk-configs            noarch    4.0-2.el8                               appstream     29 k
 java-11-openjdk             x86_64    1:11.0.15.0.10-2.el8_6                  appstream    269 k
 java-11-openjdk-headless    x86_64    1:11.0.15.0.10-2.el8_6                  appstream     40 M
 javapackages-filesystem     noarch    5.3.0-2.module+el8.3.0+125+5da1ae29     appstream     29 k

Step 3 : Check java version by using the below command

[root@linuxhelp ~]# java -version
openjdk version "11.0.15" 2022-04-19 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.15+10-LTS, mixed mode, sharing)

Step 4 : Importing the repository key from Jenkins by using the below command

[root@linuxhelp ~]# rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key 

Step 5 : Add the repository on the system by using the below command

[root@linuxhelp ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
--2022-06-29 23:10:53--  http://pkg.jenkins-ci.org/redhat/jenkins.repo
Resolving pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 52.202.51.185
Connecting to pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 71
Saving to: ‘/etc/yum.repos.d/jenkins.repo’

/etc/yum.repos.d/jenkins 100%[================================>]      71  --.-KB/s    in 0s      

2022-06-29 23:10:53 (5.00 MB/s) - ‘/etc/yum.repos.d/jenkins.repo’ saved [71/71]

step 6 : Install jenkins by using the below command

[root@linuxhelp ~]# yum install jenkins* -y
Jenkins                                                           131 kB/s | 100 kB     00:00    
Dependencies resolved.
==================================================================================================
 Package               Architecture         Version                   Repository             Size
==================================================================================================
Installing:
 jenkins               noarch               2.357-1.1                 jenkins                89 M

Transaction Summary
==================================================================================================
Install  1 Package

Total download size: 89 M
Installed size: 89 M
Downloading Packages:
jenkins-2.357-1.1.noarch.rpm                                      7.6 MB/s |  89 MB     00:11    
--------------------------------------------------------------------------------------------------
Total                                                             7.6 MB/s |  89 MB     00:11     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction

Step 7 : Enable service by using the below command

[root@linuxhelp ~]# systemctl enable jenkins
Synchronizing state of jenkins.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable jenkins
Created symlink /etc/systemd/system/multi-user.target.wants/jenkins.service → /usr/lib/systemd/system/jenkins.service.

Step 8 : Start service by using the below command

[root@linuxhelp ~]# systemctl start jenkins.service 

Step 9 : Check status by using the below command

[root@linuxhelp ~]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2022-06-29 23:13:10 EDT; 20s ago
 Main PID: 40355 (java)

Step 10 : Add firewall on port 8080 by using the below command

    [root@linuxhelp ~]# firewall-cmd --add-port=8080/tcp --permanent 
success

Step 11 : Reload firewall by using the below command

[root@linuxhelp ~]# firewall-cmd --reload 
success

Step 12 : List default zone to check the port by using the below command

[root@linuxhelp ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: cockpit dhcpv6-client ssh
  ports: 8080/tcp
  protocols: 
  forward: no
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 

Step 13 : Check the IP address by using the below command

[root@linuxhelp ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:b8:f7:db brd ff:ff:ff:ff:ff:ff
    inet 192.168.6.122/23 brd 192.168.7.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:feb8:f7db/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

step 14 : Search the system IP address by the port number of jenkins 8080 as shown in the below image

Step 15 : To unlock the jenkins admin password copy the below link as shown in the below image

step 16 : Go to the terminal and get password

[root@linuxhelp ~]# vim var/lib/jenkins/secrets/initialAdminPassword

Step 17 : Customize jenkins as shown in the below image

Step 18 : click install on organization and admin and select the plugins as shown in the below image

Step 19 : Select the plugins as shown in the below image

Step 20 : Create a new credential by adding User name and password as shown in the below image

Step 21 : Confirm the Jenkins URL by clicking save and Finish as shown in the below image

Step 22 : Click Start using Jenkins as shown in the below image

Step 23 : This is the welcome page of Jenkins

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Jenkins on Rocky Linux 8.6. Your feedback is much welcome.

Tag : Jenkins Linux
FAQ
Q
Can we use Jenkins for Unit Testing?
A
Yes, we can use Jenkins for Unit Testing.
Q
What is the minimum requirement for using Jenkins?
A
source code repository which is accessible, for instance, a Git repository.
working build script, e.g., a Maven script checked into the repository.
Q
What are the Scopes of Jenkins Credentials?
A
Jenkins credentials can be of one of the two scopes - Global & System
Q
What are the types of Jenkins pipelines?
A
Jenkins Pipelines can be either - Declarative pipelines or 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 is a Jenkins job?
A
A Job/Project is the fundamental unit of logical work (like a software build, an automation task, test execution, etc) using the Jenkins automation server and other required plugins, configurations & infrastructures.
Jobs can be of different types like - freestyle projects, multi-configuration projects, pipeline projects, multi-branch projects, etc