How to Install Jenkins on CentOS 8

Jenkins is the most popular open-source, Java-based automation server that allows you to easily set up a continuous integration and continuous delivery (CI/CD) pipeline.
Continuous integration (CI) is a DevOps practice in which team members regularly commit their code changes to the version control repository, after which automated builds and tests are run. Continuous delivery (CD) is a series of practices where code changes are automatically built, tested, and deployed to production.
This tutorial covers the steps to install Jenkins on CentOS 8 from the official Jenkins repository.
Installing Jenkins
Perform the following steps as root or user with sudo privileges to install Jenkins on CentOS 8:
Jenkins is written in Java, so the first step is to install Java. Jenkins requires Java versions 8 and 11, but some Jenkins plugins may not be compilable with Java 8.
We’ll install OpenJDK 8:
Terminalsudo dnf install java-1.8.0-openjdk-develIf you have multiple versions of Java installed on your system, make sure Java 8 is the default Java version .
The next step is to enable the Jenkins repository. Run the following commands to download the repo file and import the GPG key:
Terminalsudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.keyInstall the latest stable version of Jenkins by typing:
Terminalsudo yum install jenkinsOnce the installation process is complete, start the Jenkins service and enable it to start on system boot:
Terminalsudo systemctl start jenkins sudo systemctl enable jenkinsTo check whether Jenkins is running, type:
Terminalsystemctl status jenkinsThe output should look something like this:
outputLoaded: loaded (/etc/rc.d/init.d/jenkins; generated) Active: active (running) since Thu 2019-10-31 21:31:36 UTC; 3s ago ...
Adjusting the Firewall
If you are installing Jenkins on a remote CentOS server that is protected by a firewall
, you need to port 8080.
Use the following commands to open the necessary port:
sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
sudo firewall-cmd --reloadSetting Up Jenkins
To start the Jenkins setup process, open your browser and type the domain or server’s IP address followed by port 8080:
http://your_ip_or_domain:8080A screen similar to the following will appear, prompting you to enter the Administrator password that is created during the installation:

Use cat
to display the password on the terminal:
sudo cat /var/lib/jenkins/secrets/initialAdminPasswordYou should see a 32-character long alphanumeric password, as shown below:
e1bc55ea402640c58970b8db41e4f3bcCopy the password from the terminal, paste it into the “Administrator password” field and click “Continue”.

On the next screen, you will be asked whether you want to install the suggested plugins or to select the plugins to install. Click on the “Install suggested plugins” box and the installation process will start.

Once the installation is complete, you will be prompted to set up the first administrative user. Fill out all required information and click “Save and Continue”.

On the next page, the installer will ask you to set the URL for the Jenkins instance. The URL field will be populated with an automatically generated URL.

To complete the setup, confirm the URL by clicking on the “Save and Finish” button.

Finally, click on the “Start using Jenkins” button, and you will be redirected to the Jenkins dashboard logged in as the admin user you have created in one of the previous steps.

If you’ve reached this point, you’ve successfully installed Jenkins on your CentOS system.
Conclusion
In this tutorial, we have shown you how to install and complete the initial configuration of Jenkins on CentOS/RHEL based systems.
You can now visit the official Jenkins documentation page and start exploring Jenkins’s workflow and plug-in model.
If you have any questions, please leave a comment below.
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page