How to Install Jenkins on CentOS 8

Install Jenkins on CentOS 8

In this article, we will have explained the necessary steps to install and configure Jenkins on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

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. Jenkins is also considered an automation tool or server, It helps to automate software development which is related to building, testing, and deploying.

Prerequisite:

  • Operating System with CentOS 8
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with DNF Commands

Install Jenkins on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf install epel-release
sudo dnf update

Step 2. Install Java.

Java is one of the perquisites for Jenkins, To install the Open Java Development Kit (OpenJDK) run the following commands:

sudo dnf install java-1.8.0-openjdk-devel

Verify the Java version using the below command:

java --version

Step 3. Install Jenkins on CentOS systems.

Run the following commands to download the repo file and import the GPG key:

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key

To Install Jenkins on CentOS systems, enter the following in the terminal:

sudo dnf install jenkins

Once the installation process is complete, start the Jenkins service and enable it to start on system boot:

sudo systemctl start jenkins
sudo systemctl enable jenkins

Step 4. Configure firewall rules for Jenkins.

Allow 8080 TCP port in OS firewall for Jenkins:

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

Step 5. Setting up Jenkins.

To start setting up our Jenkins, we need to visit its web dashboard running on port 8080. so open your browser and see your public IP address or your Domain name followed by the port number through it:

http://your_ip_address_or_domain:8080

When you first access a new Jenkins instance, you are asked to unlock it using an automatically generated password:

Install Jenkins on CentOS 8

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

You should see a 32 character long alphanumeric password:

2115173b548f4e99BMWf303ee99a8732a32

Copy the password from your terminal, paste it into the Administrator password field and click Continue:

Install Jenkins on CentOS 8

Next, click on the Install suggested plugins box, and the installation process will start immediately:

Install Jenkins on CentOS 8

That’s all you need to do to install Jenkins on CentOS 8. I hope you find this quick tip helpful. For further reading on Jenkins, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.