How to Install Jenkins on CentOS 8

Previously during software development, developers would submit their code to a code repository like GitHub or Git Lab usually, the source code would be fraught with bugs and errors. To make it even worse, developers would have to wait until the entire source code was built & tested to check for errors. This was tedious, time-consuming and frustrating. There was no iterative improvement of code, and overall, the software delivery process was slow. Then came Jenkins.

Jenkins is a free and opensource continuous integration tool written in Java that allows developers to continuously develop, test and deploy code in a simple and effective way. It automates tasks thereby saving time and takes away the stressful part of the software development process.

In this article, we demonstrate how you can install Jenkins on CentOS 8 Linux.

Step 1: Install Java on CentOS 8

For Jenkins to function, you need to install either Java JRE 8 or Java 11. In the example below, we decided to go with the installation of Java 11. Therefore, to install Java 11, run the command.

# dnf install java-11-openjdk-devel
Install Java on CentOS 8
Install Java on CentOS 8

To verify the installation of Java 11, run the command.

# java --version
Check Java Version
Check Java Version

The output confirms that Java 11 has been successfully installed.

Step 2: Add Jenkins Repository on CentOS 8

Since Jenkins is not available in CentOS 8 repositories, therefore we are going to add Jenkins Repository manually to the system.

Begin by adding Jenkins Key as shown.

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

Now append Jenkin’s repository to CentOS 8.

# cd /etc/yum/repos.d/
# curl -O https://pkg.jenkins.io/redhat-stable/jenkins.repo
Add Jenkins Repository on CentOS 8
Add Jenkins Repository on CentOS 8

Step 3: Install Jenkins on CentOS 8

Having successfully added Jenkins repository, you can proceed to install Jenkins by running.

# dnf install jenkins
Install Jenkins on CentOS 8
Install Jenkins on CentOS 8

Once installed, start and verify the status of Jenkins by executing the commands.

# systemctl start jenkins
# systemctl status jenkins
Start and Verify Jenkins Status
Start and Verify Jenkins Status

The output above shows that Jenkins is up and running.

Next, you need to configure the firewall to allow access to port 8080 which is used by Jenkins. To open the port on the firewall, run the commands.

# firewall-cmd --add-port=8080/tcp --permanent
# firewall-cmd --reload
Open Jenkins Port on Firewall
Open Jenkins Port on Firewall

Step 4: Setting up Jenkins on CentOS 8

With the initial configurations done, the only remaining part is setting up Jenkins on a web browser. To achieve this, browse your server’s IP address as shown:

http://server-IP:8080

The first section requires you to unlock Jenkins using a password. This password is placed in the file /var/lib/Jenkins/secrets/initialAdminPassword file.

To read the password, simply use the cat command as shown.

# cat /var/lib/Jenkins/secrets/initialAdminPassword
View Jenkins Admin Password
View Jenkins Admin Password

Copy & paste the password in the Administrator password text field & click ‘Continue‘.

Unlock Jenkins
Unlock Jenkins

In the second stage, you will be presented with 2 options: ‘Install using suggested plugins‘ or ‘Select plugins to install‘.

For now, click on ‘Install using suggested plugins‘ to install essential plugins for our setup.

Install Suggested Plugins
Install Suggested Plugins

Shortly, the installation of the plugins will get underway.

Jenkins Plugin Installation
Jenkins Plugin Installation

In the next section, fill out the fields in order to create the First Admin user. After you are done, click on ‘Save and continue‘.

Create Jenkins Admin User
Create Jenkins Admin User

The ‘Instance Configuration‘ section will provide you with the default Jenkins URL. For simplicity, it’s recommended to leave it as it is and click ‘Save and Finish‘.

Jenkins Instance Configuration
Jenkins Instance Configuration

At this point, Jenkins setup is now complete. To access the Jenkins dashboard, simply click on ‘Start using Jenkins‘.

Jenkins Installation Complete
Jenkins Installation Complete

Jenkins’s dashboard is displayed below.

Jenkins Dashboard
Jenkins Dashboard

Next time you log into Jenkins, simply provide the Admin username and the password you specified when creating the Admin user.

Jenkins Admin Login
Jenkins Admin Login
Conclusion

That was a step-by-step procedure of how to install Jenkins Continuous Integration tool on CentOS 8. To learn more about Jenkins. Read Jenkins Documentation. Your feedback on this guide is most welcome.

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.