In this article, we will acquire a knowledge of how-to setup the Jenkins on CentOS 8 or RHEL 8. We will also go through why there is a need of an additional tool for delivering a project. But before we start with all gun blazing and put this tool to work, we should know what it is exactly and why it is needed.

Jenkins is an open-source software for continuous software development. It is based on Java and it is the only tool which can be used in every part of software development cycle.

What is Jenkins ?

Jenkins is a CI/CD tool. Here CI means continuous integration and CD means continuous delivery. Jenkins is also considered as automation tool or server, It helps to automate software development which are related to building, testing and deploying. It is a server-based tool which runs on servlet containers like Apache Tomcat.

Why do we need Jenkins tool?

As maximum organization is now having agile process. Agile methodology is a practice that promotes both continuous integration and continuous delivery, it has scrum process that can be of 2/3 weeks, which is also known as scripts. In every sprint developers and tester has to do continuous development and testing with continuous integration and continuous delivery. In every sprint client get the privilege to check that the software/application is building according to the given requirement. They also have the leverage to change/update the requirement according to their business needs. This is one of the main reasons why Jenkins is one of the most popular tools in the market nowadays.

Prerequisites:

  • Minimal CentOS 8 / RHEL 8
  • User with sudo rights
  • Stable Internet Connection
  • For RHEL 8 system, active subscription is required.

Jenkins Lab details:

  • Host Name: Jenkins.linuxtechi.com
  • IP Address: 192.168.1.190
  • SELinux : Enabled
  • Firewall: Running

Installation Steps of Jenkins on CentOS 8 / RHEL 8

Step 1) Update hosts file and apply updates

Add the following hostname entry in /etc/hosts file, run below echo command:

[[email protected] ~]$ echo "192.168.1.190   jenkins.linuxtechi.com" | sudo tee -a /etc/hosts

Install all the available updates using the beneath dnf command,

[[email protected] ~]$ sudo dnf update -y

Once all the updates are installed successfully then reboot your system once.

[[email protected] ~]$ sudo reboot

Step 2) Enable Jenkins Package Repository

Run the following command to enable Jenkins package repository for CentOS 8 / RHEL 8,

[[email protected] ~]$ sudo dnf install wget -y
[[email protected] ~]$ sudo wget http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo -O /etc/yum.repos.d/jenkins.repo

Run below rpm command to import GPG key for Jenkins packages

[[email protected] ~]$ sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key

Step 3) Install Java and Jenkins with dnf command

Java is one of the perquisites for Jenkins, so run below dnf command to install java

[[email protected] ~]$ sudo  dnf install -y java-11-openjdk-devel

Verify the java version using below command:

[email protected] ~]$ java --version

Java-version-check-centos8

Now install Jenkins using beneath dnf command,

[[email protected] ~]$ sudo dnf install -y jenkins

dnf-install-jenkins-centos8

Step 4) Start and Enable Jenkins Service via systemctl

Run following systemctl command to start and enable Jenkins service

[[email protected] ~]$ sudo systemctl start jenkins
[[email protected] ~]$ sudo systemctl enable jenkins

Verify Jenkins service status by running following command,

[[email protected] ~]$ sudo systemctl status jenkins

Jenkins-Service-Status-CentOS8

Above output confirms that Jenkins service is active and running.

Step 5) Configure firewall rules for jenkins  

Allow 8080 tcp port in OS firewall for Jenkins, run following firewall-cmd commands,

[[email protected] ~]$ sudo firewall-cmd --permanent --add-port=8080/tcp
[[email protected] ~]$ sudo firewall-cmd --reload

Step 6) Setting Up Jenkins with Web Portal

In this step, we will setup the Jenkins via its web portal, access its portal from the browser and type the URL:

http://<Server-IP>:8080

Unlock-Jenkins-CentOS8-RHEL8

The browser displays the unlock Jenkins page. It will ask to enter temporary password. To retrieve this password run following cat command from the terminal,

[[email protected] ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
802dffd0fbb74fa2bde9e6c1264a5f10
[[email protected] ~]$

Copy and paste the password into the password field and then click on continue.

Password-Jenkins-CentOS8

Jenkins will now ask to install plugins. There will be two options ‘Install using suggested plugins‘ or ‘Select plugins to install‘. It is recommended to go with ‘Install using suggested plugins ‘. So Click on the first option

Install-suggessted-plugins-Jenkins-CentOS8

Plugins-Installation-Jenkins-CentOS8

Once all the suggested plugins are installed then setup wizard will prompt us to create admin user.

Admin-User-Creation-Jenkins-CentOS8

Click on ‘Save and Continue

Jenkins-url-setup-centos8

Click on ‘Save and Finish

Jenkins-Setup-Ready-CentOS8

Click on ‘Restart’, Once Jenkins is restarted then we will get following login page:

Signin-Jenkins-CentOS8

Use the same user credentials that we have created during the Jenkins setup.

Dashboard-Jenkins-CentOS8

Above screen confirms that Jenkins has been installed successfully. That’s all from this article, please do share your feedback and comments.

The post How to Setup Jenkins on CentOS 8 / RHEL 8 first appeared on Linuxtechi.

from Linuxtechi https://www.linuxtechi.com/setup-jenkins-on-centos-8-rhel-8/