Install Jenkins on Rocky Linux:

  1. Update:
   sudo dnf update -y
  1. Install Java: Jenkins requires Java to run. Install OpenJDK 11, which is a recommended version for Jenkins:
   sudo dnf install -y java-11-openjdk-devel

(optional) sudo dnf install java-1.8.0-openjdk wget gnupg
  1. Add the Jenkins repository: Create a new repo file for Jenkins in /etc/yum.repos.d/:
   sudo tee /etc/yum.repos.d/jenkins.repo <<EOF
   
[jenkins]
name=Jenkins
baseurl=http://pkg.jenkins.io/redhat-stable/
enabled=1
gpgcheck=1
gpgkey=https://pkg.jenkins.io/redhat-stable/jenkins.io.key
  1. Import the Jenkins GPG key:
   sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
  1. Install Jenkins:
   sudo dnf install -y jenkins
  1. Start and enable Jenkins service:
   sudo systemctl start jenkins
   sudo systemctl enable jenkins
  1. Open the necessary firewall ports: Jenkins by default runs on port 8080. To allow traffic through this port, run:
   sudo firewall-cmd --permanent --zone=public --add-port=8080/tcp
   sudo firewall-cmd --reload
  1. Access Jenkins: Open web browser and navigate to http://localhost:8080, should see the Jenkins setup wizard.
  2. Retrieve the initial admin password: To complete the setup wizard, will need the initial admin password. Can retrieve it using the following command:
sudo su -
cd /var/lib/jenkins/secrets/
cat /var/lib/jenkins/secrets/initialAdminPassword | xclip -selection clipboard

Use this password to unlock Jenkins and complete the initial setup.

By davs

One thought on “Install Jenkins in Rocky Linux 9”

Leave a Reply