Jenkins is an open-source software package for continuous software development. It is used to automate parts of the build, testing, delivery, and deployment of applications.
Jenkins is based on Java and helps with every part of the software development process.
This guide will show you how to install Jenkins on CentOS 8.
- A Linux system with CentOS 8 Installed
- A user account with sudo or root privileges
- Access to a terminal window/command line
- Java version 8
A Brief Note on Jenkins
Jenkins is a CI/CD software application. CI stands for Continuous Integration, which refers to implementing changes throughout the software development process. CD stands for Continuous Delivery, which refers to a continuous stream of updates for an application.
Jenkins requires Java to run. It will work with either Java 8 or Java 11, but some plugins aren’t compatible with Java 11. This guide uses the open-source Java JDK 8 environment. JDK stands for Java Developer Kit, and it includes all the files needed to run Java applications.
Step 1: Install Java
Install Java 8 on your system. If you already have Java 8 installed and set as the default, skip ahead to Step 2.
Open a terminal window, and enter the following:
sudo dnf install java-1.8.0-openjdk-devel
The system will scan the repositories, then prompt you for confirmation. Type
y and press Enter. Allow the system to download and install Java.
Step 2: Add Jenkins Software Repository
Jenkins isn’t included in the default CentOS software repositories. To add the Jenkins repository, open a terminal window, and enter the following:
sudo wget –O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
The system will reach out to the Jenkins server and download the location of the repository to your system. It should display
Adding the repository manually – In some instances, the repository will not download correctly. To manually add the repository, enter the following:
sudo nano /etc/yum.repos.d/jenkins.repo
This will open the jenkins.repo file for editing. Enter the following lines:
Save the file (
ctrl-o) and exit (
ctrl-x). The file should look like this:
Next, import the GPG key to ensure your software is legitimate:
sudo rpm ––import https://pkg.jenkins.io/redhat/jenkins.io.key
If the process is successful, the system returns a new command line without error.
Note: You may have noticed that the repository lists Red Hat, but your system is CentOS. This is because CentOS is based on the Red Hat Linux architecture.
Step 3: Install Jenkins on CentOS 8
To Install Jenkins on CentOS 8, enter the following in the terminal:
sudo dnf install jenkins
If you receive an error that mentions “jenkins not found,” go back and add the repository manually as outlined in the previous step.
The system will prompt you to confirm the installation. Type
y, press Enter, and let the installation complete.
Start Jenkins Service
To start the Jenkins service and enable it at startup, enter the following:
sudo systemctl start jenkins
sudo systemctl enable jenkins
To display the status of the Jenkins service, enter the following:
sudo systemctl status jenkins
Step 4: Set Firewall to Allow Jenkins
The Jenkins service uses port 8080 to communicate. If you’re using the default firewalld service, enter the following commands to allow access:
sudo firewall-cmd ––permanent ––zone=public ––add-port=8080/tcp
sudo firewall-cmd ––reload
The system reports success for each command.
If you’re using a different firewall, follow its instructions to allow TCP traffic on port 8080.
Step 5: Run and Set up Jenkins on CentOS 8
Next, you’ll test your system to make sure Jenkins is working correctly. Open a web browser, and enter the following URL:
If your server is remote or has a specific hostname, domain name, or IP address, use that instead.
The browser should display an Unlock Jenkins page. It will ask you to enter a temporary password.
This password was created automatically (but not displayed) during setup. To find it, switch to a terminal window and enter the following:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
The location is displayed on the Getting Started / Unlock Jenkins page.
The system will display an alphanumeric code. Copy this code and paste it into the password field. Then click Continue.
Jenkins will prompt you to install plugins. It is recommended that you Install suggested plugins. You can always change or customize plugins later.
Once plugins are configured, you’ll be prompted to Create First Admin User. Enter the values you want for your Jenkins Administrator, then click Save and Continue.
The last page will display the Instance Configuration. This shows the hostname Jenkins is configured for. This is usually the same hostname you typed into your browser to access the Getting Started page. If you do not create an admin user, there will be a warning.
Click Save and Finish to start using Jenkins.
This step takes you to the Jenkins dashboard where you can create new jobs.
Note: Refer to phoenixNAP's Jenkins tutorial for beginners to learn all you need to know about Jenkins.
You should now have a working installation of Jenkins on your CentOS 8 system. If you followed the steps in this guide, your Jenkins dashboard should load properly, and you can start creating jobs.