Thursday, December 26, 2024
Google search engine
HomeGuest BlogsHow To Install Jenkins on Rocky Linux 8

How To Install Jenkins on Rocky Linux 8

.tdi_3.td-a-rec{text-align:center}.tdi_3 .td-element-style{z-index:-1}.tdi_3.td-a-rec-img{text-align:left}.tdi_3.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_3.td-a-rec-img{text-align:center}}

Jenkins is a free to use and open-source automation server created to help Developers automate most repetitive technical tasks that exist in the continuous integration and delivery of software. The core of Jenkins is developed in Java programming language and can be installed from YUM repository packages or by running the web application archive (WAR) file on a web server. In this blog post we will perform RPM package based installation of Jenkins on Rocky Linux 8 system.

The key requirements for the installation are:

  • A Rocky Linux 8 server with internet access
  • A user that will perform the installation should have sudo privileges
  • A system with 4GB memory – More recommended for good performance / heavy use case
  • At least 10 GB disk space

This installation guide will start with Software requirements installation; mainly Java. As Rocky Linux 8 contains both Java 8 and 11, we will install Java 11 runtime environment. But Jenkins allows ANY version of JRE/JDK to be invoked during the build. When using Maven Integration Plugin, the version of JDK used for the build must be equal to the version used by Jenkins.

.tdi_2.td-a-rec{text-align:center}.tdi_2 .td-element-style{z-index:-1}.tdi_2.td-a-rec-img{text-align:left}.tdi_2.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_2.td-a-rec-img{text-align:center}}

We can now go through installation steps for Jenkins Server on Rocky Linux 8 Server / Workstation machine.

Step 1: Install OpenJDK 11 on Rocky Linux 8

JDK 11 is the open-source reference implementation of version 11. The package is available in Rocky Linux 8 distributed through system repositories.

Confirm that system repositories are working:

$ sudo dnf repolist
repo id                                                                  repo name
appstream                                                                Rocky Linux 8 - AppStream
baseos                                                                   Rocky Linux 8 - BaseOS
extras                                                                   Rocky Linux 8 - Extras

List available releases of JDK on Rocky Linux 8:

$ sudo dnf search java-*-openjdk
Last metadata expiration check: 2:07:22 ago on Wed 07 Jul 2021 10:12:17 AM UTC.
================================================================== Name Matched: java-*-openjdk ==================================================================
java-1.8.0-openjdk.x86_64 : OpenJDK 8 Runtime Environment
java-11-openjdk.x86_64 : OpenJDK 11 Runtime Environment

Let’s install the latest version of Java available, which in this case is java-11-openjdk package:

sudo dnf -y install java-11-openjdk

Running java -version command should print the default version of Java set on the system:

$ java -version
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode, sharing)

Step 2: Add Jenkins YUM repository to Rocky Linux

Jenkins team maintains a repository with Jenkins RPM packages. We will add this repository then later install packages from it.

Install wget command that is needed when downloading the repo file:

sudo dnf -y install wget

Use wget command to download jenkins.repo file and place it in the correct directory:

sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

Also import GPG key used to sign Jenkins packages:

sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

Let’s check if the repository is now available for local use:

$ sudo dnf repolist
repo id                                                                  repo name
appstream                                                                Rocky Linux 8 - AppStream
baseos                                                                   Rocky Linux 8 - BaseOS
extras                                                                   Rocky Linux 8 - Extras
jenkins                                                                  Jenkins-stable

Step 3: Install Jenkins Server on Rocky Linux 8

Once our repository has been added and confirmed to be working we can begin installation of Jenkins package on Rocky Linux 8 system:

sudo dnf install jenkins

Proceed with the installation:

Dependencies resolved.
==================================================================================================================================================================
 Package                               Architecture                         Version                                   Repository                             Size
==================================================================================================================================================================
Installing:
 jenkins                               noarch                               2.289.2-1.1                               jenkins                                71 M

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

Total download size: 71 M
Installed size: 71 M
Is this ok [y/N]: y

Package size is less than 100mb:

Total                                                                                                                              48 MB/s |  71 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                          1/1
  Running scriptlet: jenkins-2.289.2-1.1.noarch                                                                                                               1/1
  Installing       : jenkins-2.289.2-1.1.noarch                                                                                                               1/1
  Running scriptlet: jenkins-2.289.2-1.1.noarch                                                                                                               1/1
  Verifying        : jenkins-2.289.2-1.1.noarch                                                                                                               1/1

Installed:
  jenkins-2.289.2-1.1.noarch

Complete!

Start Jenkins service on Rocky Linux 8:

sudo systemctl start jenkins

Don’t forget to set the service to start at system boot up:

$ sudo systemctl enable jenkins
jenkins.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable jenkins

Check service status – It should show as running:

$ systemctl status jenkins
 jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; generated)
   Active: active (running) since Wed 2021-07-07 12:28:25 UTC; 1min 5s ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 49 (limit: 101105)
   Memory: 2.7G
   CGroup: /system.slice/jenkins.service
           └─9966 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins>

Step 4: Configure Jenkins on Rocky Linux 8 from web interface

After installation and starting the service, head over to web browser console on URL:

http://server_ip_or_hostname:8080

You should get welcome page and printed tip on how to get initial admin password:

install jenkins rocky linux 8 01

Copy the password from the location shown:

$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
42729632aa004afc8c4cb2469bdd6cfc

Paste it in the input text box:

install jenkins rocky linux 8 02

Choose to extend Jenkins with additional features to support many different needs by adding Plugins. At this stage it is okay to go with “Install Suggested Plugins

install jenkins rocky linux 8 03

This installs a standard set of plugins to have a functional setup of Jenkins on Rocky Linux 8.

install jenkins rocky linux 8 04

When done you’re asked to create the first Admin User

install jenkins rocky linux 8 05

In the “Instance Configuration” screen confirm or change the Jenkins URL – This is used to provide the root URL for absolute links to various Jenkins resources.

install jenkins rocky linux 8 06

You have completed Jenkins setup and you can start using Jenkins on Rocky Linux 8

install jenkins rocky linux 8 07

Step 5: Configure Nginx and secure Jenkins with Let’s Encrypt

if you prefer accessing the server through an actual domain name, which is recommended for securing the server with SSL Certificates, use our guide in the link below to get steps on how-to:

Configure Jenkins behind Nginx and Secure With Let’s Encrypt SSL

Other articles available on this website around Jenkins Server Administration are:

Good On-demand Video Courses to Learn Jenkins:

.tdi_4.td-a-rec{text-align:center}.tdi_4 .td-element-style{z-index:-1}.tdi_4.td-a-rec-img{text-align:left}.tdi_4.td-a-rec-img img{margin:0 auto 0 0}@media(max-width:767px){.tdi_4.td-a-rec-img{text-align:center}}

RELATED ARTICLES

Most Popular

Recent Comments