This article will show you how to install Jenkins server on RHEL 7
Add Jenkins repo to RHEL
# Add jenkins repo
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
# Import repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
# Upgrade
sudo yum upgrade
Add required dependencies for Jenkins server
Install Jenkins
sudo yum install jenkins
# Enable jenkins as service when server start
sudo systemctl enable jenkins
# Start Jenkins server
sudo systemctl start jenkins
# Check status
sudo systemctl status jenkins
# Output
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2022-08-06 23:37:25 ADT; 7s ago
Main PID: 4106 (java)
Tasks: 52
CGroup: /system.slice/jenkins.service
└─4106 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=%C/jenkins/war --httpPort=8080
Create a script file to open Jenkins port in RHEL firewall
# jenkins_firewall.sh
YOURPORT=8080
PERM="--permanent"
SERV="$PERM --service=jenkins"
firewall-cmd $PERM --new-service=jenkins
firewall-cmd $SERV --set-short="Jenkins ports"
firewall-cmd $SERV --set-description="Jenkins port exceptions"
firewall-cmd $SERV --add-port=$YOURPORT/tcp
firewall-cmd $PERM --add-service=jenkins
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
Visit http://your-server-ip:8080 to complete Jenkins setup
Reference
https://pkg.jenkins.io/redhat/