How To Install Jenkins on RHEL 8 & CentOS 7 / RHEL 7

0

Jenkins is an open-source CI (continuous integration) tool written in Java that helps to automate the repetitive tasks like software build, testing, and deployments involved in the software development process

Jenkins project was originally developed as the Hudson project and was renamed after a dispute with Oracle.

Here, we will see how to install Jenkins on RHEL 8 & CentOS 7 / RHEL 7.

Prerequisites

Install Java

Jenkins requires Java JRE 8 or Java JRE 11. Here, I will install OpenJDK 8.

yum -y install java-1.8.0-openjdk wget

In case you want to use the Oracle Java instead of OpenJDK, follow the below link to install it.

READ: How To install Oracle Java on CentOS 7 / RHEL 7

READ: How To Install Oracle Java on RHEL 8

Once the installation is complete, verify the Java version.

java -version

Output:

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode)

Add Jenkins repository

Jenkins is not available on the OS repository. So, we will add Jenkin’s official repository on the system for Jenkins installation.

Add the Jenkins key to the system.

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

Add the Jenkins repository to your system.

cd /etc/yum.repos.d/

curl -O https://pkg.jenkins.io/redhat-stable/jenkins.repo

Install Jenkins

Now, install Jenkins using the following command.

yum -y install jenkins

Start Jenkins service.

systemctl start jenkins

Enable auto-start of Jenkins service on system boot.

systemctl enable jenkins

Check the status of Jenkins service.

systemctl status jenkins
Install Jenkins on RHEL 8 - Jenkins Service Status
Install Jenkins on RHEL 8 – Jenkins Service Status

Firewall

Configure the firewall to allow access for Jenkins portal from external machines.

firewall-cmd --permanent --add-port=8080/tcp

firewall-cmd --reload

Setup Jenkins

With Jenkins’s web interface, we can build, test, and deploy software. Before accessing the Jenkins web interface, we need to set up it.

Open up a web browser and go to the following URL.

http://your.ip.add.ress:8080

For security reason, Jenkins puts up the initial password in /var/lib/Jenkins/secrets/initialAdminPassword file to prevent an unauthorized Jenkins installation.

Read the file with below command and get the password for Jenkins installation.

cat /var/lib/jenkins/secrets/initialAdminPassword

Output:

18b628b7df874031932d2400e3b9d050
Initial Jenkins Admin Password
Initial Jenkins Admin Password

Copy and paste the password on Jenkins setup wizard, and then click on Continue.

Install Jenkins on RHEL 8 - Unlock Jenkins
Install Jenkins on RHEL 8 – Unlock Jenkins

Either install suggested plugins or select plugins to install based on your needs. I recommend you to install suggested plugins to install most useful plugins for now, and of course, you can install required plugins later.

Install Jenkins on RHEL 8 - Customize Jenkins
Install Jenkins on RHEL 8 – Customize Jenkins

Wait for the plugins to install.

Install Jenkins on RHEL 8 - Jenkins Plugin Installation
Install Jenkins on RHEL 8 – Jenkins Plugin Installation

Create the first admin user for Jenkins.

Install Jenkins on RHEL 8 - Create Admin User
Install Jenkins on RHEL 8 – Create Admin User

Set up the root URL for Jenkins.

Install Jenkins on RHEL 8 - Instance Configuration
Install Jenkins on RHEL 8 – Instance Configuration

Jenkins is now complete. You can start working on Jenkins by clicking on Start using Jenkins.

Install Jenkins on RHEL 8 - Jenkins Setup Complete
Install Jenkins on RHEL 8 – Jenkins Setup Complete

Access Jenkins

To access Jenkins, go to the below URL using the browser.

http://your.ip.add.ress:8080

Log in with the Jenkins’s admin account your created few steps back.

Jenkins Login Page
Jenkins Login Page

Upon successful login, you will get the Jenkins dashboard.

Jenkins Dashboard
Jenkins Dashboard

Conclusion

That’s All. You have learned how to install Jenkins on RHEL 8 & CentOS 7 / RHEL 7. Additionally, see how to create your first Jenkins project. Also, read Jenkins’s documentation for more information. Please share your feedback in the comments section.

You might also like