How To Install Jenkins on Rocky Linux 9
In this tutorial, we will show you how to install Jenkins on Rocky Linux 9. For those of you who didn’t know, Jenkins is an open-source continuous integration tool that helps automate the software build, testing, and deployments involved in the software development process. It is a server-based application written in Java, and it typically runs as a background service on Windows or Unix machines. We use Jenkins to automatically monitor the repository for changes to our source code. As soon as someone pushes his/her changes to the central source code repository, Jenkins analyzes the new source files for changes.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Jenkins automation server on Rocky Linux. 9.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A network connection or internet access.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Jenkins on Rocky Linux 9
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf check-update sudo dnf install dnf-utils sudo dnf install epel-release
Step 2. Installing Java OpenJDK.
Jenkins can run on JDK 11. In this step, we install JDK Java using the following command below:
sudo dnf install java-11-openjdk java-11-openjdk-devel
If all installation is completed, verify your Java OpenJDK version using the following command:
java -version
Step 3. Installing Jenkins on Rocky Linux 9.
By default, Jenkins is not available on the Rocky Linux 9 base repository. Now run the following command below to add the Jenkins repository to your system:
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
After the repository has been added, you can install Jenkins using the following command below:
sudo dnf install jenkins
Now that Jenkins is installed, let us start it using this command:
sudo systemctl enable jenkins sudo systemctl start jenkins
Step 4. Configure Firewall Rules.
Jenkins listens on port 8080 by default, now allow it through the firewall as shown:
sudo firewall-cmd --add-port=8080/tcp --zone=public --permanent sudo firewall-cmd --reload
Step 5. Accessing Jenkins Web Interface.
Once successfully installed, you can access the Jenkins application by visiting the URL http://your-server-ip-address:8080
. You will see the following page:
Jenkins will create a password for the Admin user, to find that run the below command and then copy the same:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Congratulations! You have successfully installed Jenkins. Thanks for using this tutorial for installing Jenkins provides a powerful and flexible automation platform on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Jenkins website.