Operations 6 min read

How to Install and Configure Jenkins on CentOS 7

This guide walks through installing Jenkins on CentOS 7, covering prerequisite JDK setup, repository configuration, service start‑up, troubleshooting common startup errors, firewall adjustments, and port configuration to get a functional CI/CD server.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Full-Stack Internet Architecture
How to Install and Configure Jenkins on CentOS 7

What is Jenkins

Jenkins provides continuous integration services for software development and runs inside a servlet container such as Apache Tomcat. It supports many SCM tools (AccuRev, CVS, Subversion, Git, Perforce, Clearcase, RTC) and can execute projects built with Apache Ant, Maven, arbitrary shell scripts, or Windows batch commands.

In simple terms, Jenkins automates the development workflow: when code is pushed to Git, Jenkins automatically pulls the latest changes and performs deployment tasks.

Jenkins Installation on CentOS 7

Jenkins requires a JDK environment (the JDK installation steps are omitted here).

After installing the JDK, the following commands install Jenkins (comments follow the # symbol):

# Download Jenkins repository
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

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

# Install Jenkins
yum install -y jenkins

# Start Jenkins service
systemctl start jenkins

At this point, Jenkins is installed on CentOS.

You can access Jenkins via http:// your-ip :8080 in a browser (see screenshot).

After clicking "Continue", another setup screen appears (see screenshot).

Follow the prompts to complete the installation.

Possible Issues

1. Jenkins fails to start (systemctl reports an error).

Run systemctl status jenkins.service to view detailed error information.

The error typically indicates that Jenkins could not find the Java environment. Edit the Jenkins init script to add the Java path:

vi /etc/rc.d/init.d/jenkins

Modify the candiddates (or similar) parameter to include the Java environment variable, then save.

After editing, restart Jenkins:

# Restart Jenkins service
systemctl restart jenkins.service

# Verify status
systemctl status jenkins.service

2. Jenkins is installed but not reachable from outside the host, often due to firewall settings.

Instead of disabling the firewall, open the required port (default 8080):

# Open port 8080 permanently
firewall-cmd --zone=public --add-port=8080/tcp --permanent
# Reload firewall
systemctl restart firewalld.service

# Explanation:
# --zone specifies the firewall zone
# --add-port=8080/tcp adds the TCP port
# --permanent makes the rule persistent across reboots

If port 8080 conflicts with another service, change Jenkins' default port by editing vi /etc/sysconfig/jenkins and modifying the JENKINS_PORT variable.

After these steps, Jenkins should be fully operational without issues.

< END >

ci/cddevopsfirewallInstallationJenkinsCentOS7
Full-Stack Internet Architecture
Written by

Full-Stack Internet Architecture

Introducing full-stack Internet architecture technologies centered on Java

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.