Archival Notice
This guide was written for CentOS 7 and legacy installations of Jenkins using OpenJDK 8. Please note that CentOS 7 has reached End of Life (EOL), and modern Jenkins releases require Java 17 or 21. Please refer to the official Jenkins documentation for current installation requirements.
Jenkins is one of the most widely used open-source automation servers, enabling developers around the world to reliably build, test, and deploy their applications through continuous integration and continuous delivery (CI/CD) pipelines.
In this guide, I will walk you through installing and configuring a standalone Jenkins server on CentOS 7, installing Java dependencies, importing official repository signing keys, configuring the system firewall, and retrieving the initial administrator password.
Prerequisites
You will need a CentOS 7 virtual machine or physical server with root privileges, configured with a minimum of 2 GB of RAM for smooth pipeline executions.
Step 1: System Update and SELinux Configuration
First, update your system packages and install necessary utilities like epel-release and network troubleshooting tools.
yum update -y
yum install epel-release yum-utils bash-completion net-tools iftop htop -y
To ensure Jenkins and its build agents operate without unexpected permission restrictions on CentOS 7, disable SELinux:
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
Reboot the machine to apply the SELinux changes and bring up the latest kernel:
reboot
Recommended VM Snapshot
After the system finishes rebooting, taking a baseline VM snapshot is highly recommended before installing Jenkins and Java dependencies.
Step 2: Install OpenJDK
Jenkins is a Java-based application and requires a Java Runtime Environment (JRE) to execute. We will install OpenJDK 8 development utilities:
yum update -y
yum install java-1.8.0-openjdk-devel -y
Verify the Java installation and version:
java -version
Step 3: Add Official Jenkins Repository and Signing Key
To ensure we receive the latest stable releases directly from the Jenkins project, add the official Red Hat stable repository and import its GPG signing keys:
curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Step 4: Install and Start Jenkins Server
With the repository configured, install the Jenkins automation server package:
yum install jenkins -y
Enable the Jenkins service to start automatically on system boot, and start the daemon:
systemctl enable jenkins
systemctl start jenkins
systemctl status jenkins
Step 5: Firewall Configuration
Jenkins runs on HTTP port 8080 by default. Allow incoming web traffic on port 8080/tcp in the system firewall so you can access the web UI:
firewall-cmd --permanent --zone=public --add-port=8080/tcp
firewall-cmd --reload
firewall-cmd --list-all
Step 6: Unlocking Jenkins (Initial Administrator Setup)
When you navigate to your Jenkins web interface for the first time (http://<YOUR_SERVER_IP>:8080), Jenkins will prompt you for an initial administrator password to unlock the initial installation wizard.
Retrieve this auto-generated secret from the filesystem:
cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the alphanumeric string printed by this command and paste it into your browser wizard. You can then proceed to install suggested plugins and create your first administrative user!