Install Jenkins on Rocky Linux:
- Update:
sudo dnf update -y
- 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
- 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
- Import the Jenkins GPG key:
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
- Install Jenkins:
sudo dnf install -y jenkins
- Start and enable Jenkins service:
sudo systemctl start jenkins
sudo systemctl enable jenkins
- 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
- Access Jenkins: Open web browser and navigate to
http://localhost:8080
, should see the Jenkins setup wizard. - 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.
test