Install Jenkins Server on Centos 8 with Yum utility

Ticker

6/recent/ticker-posts

Install Jenkins Server on Centos 8 with Yum utility

 Question : The DevOps team of xFusionCorp Industries is planning to setup some CI/CD pipelines. After several meetings they have decided to use Jenkins server. So, we need to setup a Jenkins Server as soon as possible. Please complete the task as per requirements mentioned below:

1. Install jenkins on jenkins server using yum utility only, and start its service. You might face timeout issue while starting the Jenkins service, please refer this link for help.

2. Jenkin's admin user name should be theadmin, password should be Adm!n321, full name should be Ravi and email should be ravi@jenkins.stratos.xfusioncorp.com.

Note:

1. For this task, ssh into the jenkins server using user root and password S3curePass from jump host.

2. After installing the Jenkins server, please click on the Jenkins button on the top bar to access Jenkins UI and follow the on-screen instructions to create an admin user.

This task is based on web UI, you can refer below Video Solution for better understanding 

Jenkins is a popular open source CI (Continuous Integration) tool which is widely used for project development, deployment, and automation.

This article will guide you through the process of installing Jenkins on a Ubuntu server 


Prerequisites : - 

Install wget packages.

Install JAVA packages.

Install & Configure Jenkins repo


Solution:  

1. Login on the jenkins server as a root 

thor@jump_host ~$ ssh root@jenkins

The authenticity of host 'jenkins (172.16.238.19)' can't be established.

ECDSA key fingerprint is SHA256:hUhy2DXm1NszEfg2/amH47QBuyiU+HyhCuaPDc3VaMk.

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

Warning: Permanently added 'jenkins,172.16.238.19' (ECDSA) to the list of known hosts.

root@jenkins's password:

[root@jenkins ~]#


2. Install wget package 

[root@jenkins ~]# yum install wget -y

Updating Subscription Management repositories.

Unable to read consumer identity

 

This system is not registered with an entitlement server. You can use subscription-manager to register.

 

Last metadata expiration check: 0:02:46 ago on Sat Aug 19 08:16:17 2023.

Dependencies resolved.

=================================================================================================================================================================================

 Package                                    Architecture                          Version                                         Repository                                Size

=================================================================================================================================================================================

Installing:

 wget                                       x86_64                                1.19.5-11.el8                                   appstream                                734 k

Installing dependencies:

 libmetalink                                x86_64                                0.1.3-7.el8                                     baseos                                    32 k

 

Transaction Summary

=================================================================================================================================================================================

Install  2 Packages

 Total download size: 766 k

Installed size: 2.8 M

Installed:

  libmetalink-0.1.3-7.el8.x86_64                                                            wget-1.19.5-11.el8.x86_64                                                          

 Complete!

[root@jenkins ~]#

3. Download Jenkins repo and configure it

[root@jenkins ~]# wget -O /etc/yum.repos.d/jenkins.repo \

>     https://pkg.jenkins.io/redhat-stable/jenkins.repo

--2023-08-19 08:19:13--  https://pkg.jenkins.io/redhat-stable/jenkins.repo

Resolving pkg.jenkins.io (pkg.jenkins.io)... 151.101.2.133, 151.101.66.133, 151.101.130.133, ...

Connecting to pkg.jenkins.io (pkg.jenkins.io)|151.101.2.133|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 85

Saving to: '/etc/yum.repos.d/jenkins.repo'

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

 2023-08-19 08:19:14 (6.82 MB/s) - '/etc/yum.repos.d/jenkins.repo' saved [85/85]

 [root@jenkins ~]# ls -l /etc/yum.repos.d/

total 60

-rw-r--r-- 1 root root  713 Mar 28  2022 CentOS-Stream-AppStream.repo

-rw-r--r-- 1 root root  698 Mar 28  2022 CentOS-Stream-BaseOS.repo

-rw-r--r-- 1 root root  316 Mar 28  2022 CentOS-Stream-Debuginfo.repo

-rw-r--r-- 1 root root  744 Mar 28  2022 CentOS-Stream-Extras-common.repo

-rw-r--r-- 1 root root  700 Mar 28  2022 CentOS-Stream-Extras.repo

-rw-r--r-- 1 root root  734 Mar 28  2022 CentOS-Stream-HighAvailability.repo

-rw-r--r-- 1 root root  696 Mar 28  2022 CentOS-Stream-Media.repo

-rw-r--r-- 1 root root  683 Mar 28  2022 CentOS-Stream-NFV.repo

-rw-r--r-- 1 root root  718 Mar 28  2022 CentOS-Stream-PowerTools.repo

-rw-r--r-- 1 root root  690 Mar 28  2022 CentOS-Stream-RealTime.repo

-rw-r--r-- 1 root root  748 Mar 28  2022 CentOS-Stream-ResilientStorage.repo

-rw-r--r-- 1 root root 1771 Mar 28  2022 CentOS-Stream-Sources.repo

-rw-r--r-- 1 root root   85 Nov 29  2016 jenkins.repo

-rw-r--r-- 1 root root  358 Feb  8  2023 redhat.repo

-rw-r--r-- 1 root root 2736 Feb  7  2023 ubi.repo

[root@jenkins ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key

[root@jenkins ~]#


4. Install Jenkins package using YUM

[root@jenkins ~]# yum install jenkins

Updating Subscription Management repositories.

Unable to read consumer identity

 This system is not registered with an entitlement server. You can use subscription-manager to register.

 Jenkins-stable                                                                                                                                   151 kB/s |  27 kB     00:00   

Dependencies resolved.

=================================================================================================================================================================================

 Package                                  Architecture                            Version                                         Repository                                Size

=================================================================================================================================================================================

Installing:

 jenkins                                  noarch                                  2.401.3-1.1                                     jenkins                                   94 M

 

Transaction Summary

=================================================================================================================================================================================

Install  1 Package

 Total download size: 94 M

Installed size: 94 M

Is this ok [y/N]: y

Downloading Packages:

jenkins-2.401.3-1.1.noarch.rpm                                                                                                                    40 MB/s |  94 MB     00:02   

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                             40 MB/s |  94 MB     00:02    

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                         1/1

  Running scriptlet: jenkins-2.401.3-1.1.noarch                                                                                                                              1/1

  Installing       : jenkins-2.401.3-1.1.noarch                                                                                                                              1/1

  Running scriptlet: jenkins-2.401.3-1.1.noarch                                                                                                                              1/1

  Verifying        : jenkins-2.401.3-1.1.noarch                                                                                                                              1/1

Installed products updated.

 Installed:

  jenkins-2.401.3-1.1.noarch                                                                                                                                                     

 Complete!

[root@jenkins ~]#


5. While starting Jenkins services you may get error for java.

[root@jenkins ~]# systemctl daemon-reload

[root@jenkins ~]#

[root@jenkins ~]# systemctl start jenkins

Job for jenkins.service failed because the control process exited with error code.

See "systemctl status jenkins.service" and "journalctl -xe" for details.

[root@jenkins ~]#


6. Install Java package

root@jenkins ~]# yum install java-17-openjdk

Updating Subscription Management repositories.

Unable to read consumer identity

 This system is not registered with an entitlement server. You can use subscription-manager to register.

 Last metadata expiration check: 0:02:03 ago on Sat Aug 19 08:20:11 2023.

Dependencies resolved.

=================================================================================================================================================================================

 Package                                       Architecture               Version                                                 Repository                                Size

=================================================================================================================================================================================

Installing:

 java-17-openjdk                               x86_64                     1:17.0.8.0.7-2.el8                                      ubi-8-appstream-rpms                     457 k

Installing dependencies:

 adwaita-cursor-theme                          noarch                     3.28.0-3.el8                                            appstream                                647 k

 adwaita-icon-theme                            noarch                     3.28.0-3.el8                                            appstream                                 11 M

 alsa-lib                                      x86_64                     1.2.9-1.el8                                             appstream     

(84/85): nss-softokn-3.79.0-11.el8_7.x86_64.rpm                                                                                                  7.2 MB/s | 1.2 MB     00:00   

(85/85): java-17-openjdk-headless-17.0.8.0.7-2.el8.x86_64.rpm                                                                                     78 MB/s |  47 MB     00:00   

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                            7.2 MB/s |  78 MB     00:10    

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Running scriptlet: copy-jdk-configs-4.0-2.el8.noarch                                                                                                                       1/1

  Running scriptlet: java-17-openjdk-headless-1:17.0.8.0.7-2.el8.x86_64                                                                                                      1/1

  Preparing        :                                                                                                                                                         1/1

  Installing       : libpng-2:1.6.34-5.el8.x86_64                                                                                                                           1/85

  Installing       : freetype-2.9.1-9.el8.x86_64       

  pixman-0.38.4-2.el8.x86_64                         pkgconf-1.4.2-1.el8.x86_64                              pkgconf-m4-1.4.2-1.el8.noarch                                      

  pkgconf-pkg-config-1.4.2-1.el8.x86_64              rest-0.8.1-2.el8.x86_64                                 shared-mime-info-1.9-3.el8.x86_64                                  

  ttmkfdir-3.0.9-54.el8.x86_64                       xkeyboard-config-2.28-1.el8.noarch                      xorg-x11-font-utils-1:7.5-41.el8.x86_64                             

  xorg-x11-fonts-Type1-7.5-19.el8.noarch           

 Complete!

[root@jenkins ~]#


7. Start Jenkins services & check the status 

[root@jenkins ~]# systemctl start jenkins

[root@jenkins ~]# systemctl status jenkins

● jenkins.service - Jenkins Continuous Integration Server

   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)

   Active: active (running) since Sat 2023-08-19 08:06:30 UTC; 14s ago

 Main PID: 3428 (java)

    Tasks: 96 (limit: 1340692)

   Memory: 1.4G

   CGroup: /docker/b326ce4197106eefcd34e79c578840f8bbaea430ce39537adbf366e2d0742d48/system.slice/jenkins.service

           └─3428 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080

 

Aug 19 08:05:54 jenkins.stratos.xfusioncorp.com jenkins[3428]: Jenkins initial setup is required. An admin user has been created and a password generated.

Aug 19 08:05:54 jenkins.stratos.xfusioncorp.com jenkins[3428]: Please use the following password to proceed to installation:

Aug 19 08:05:54 jenkins.stratos.xfusioncorp.com jenkins[3428]: 00dd1d3ea16e4459a89fc930d06cb98e

Aug 19 08:05:54 jenkins.stratos.xfusioncorp.com jenkins[3428]: This may also be found at: /var/lib/jenkins/secrets/initialAdminPassword

Aug 19 08:05:54 jenkins.stratos.xfusioncorp.com jenkins[3428]: *************************************************************

Aug 19 08:06:30 jenkins.stratos.xfusioncorp.com jenkins[3428]: 2023-08-19 08:06:30.348+0000 [id=75]        INFO        jenkins.InitReactorRunner$1#onAttained: Completed initialization

Aug 19 08:06:30 jenkins.stratos.xfusioncorp.com jenkins[3428]: 2023-08-19 08:06:30.630+0000 [id=37]        INFO        hudson.lifecycle.Lifecycle#onReady: Jenkins is fully up and running

Aug 19 08:06:30 jenkins.stratos.xfusioncorp.com systemd[1]: Started Jenkins Continuous Integration Server.

Aug 19 08:06:31 jenkins.stratos.xfusioncorp.com jenkins[3428]: 2023-08-19 08:06:31.129+0000 [id=137]        INFO        h.m.DownloadService$Downloadable#load: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller

Aug 19 08:06:31 jenkins.stratos.xfusioncorp.com jenkins[3428]: 2023-08-19 08:06:31.130+0000 [id=137]        INFO        hudson.util.Retrier#start: Performed the action check updates server successfully at the attempt #1

[root@jenkins ~]#

8. Open WEB GUI and proceed with further installation   (refer Below video attached)

9. To unlock jenkins use initial password store in file 

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

00dd1d3ea16e4459a89fc930d06cb98e

[root@jenkins ~]#


10 . Click on Finish & Confirm to complete the task successful

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , 

please go through and share your comments. Like and share the knowledge




Post a Comment

0 Comments

Latest Posts