Hello, friends. In this post, we will talk about a vital tool in continuous integration. Today, you will learn how to install Jenkins on Rocky Linux 9 / Alma Linux 9.
Jenkins is an open-source server for continuous integration. It is a tool used to compile and test software projects continuously. This has the advantage that developers can quickly integrate their changes into the software on the application server.
Some details about Jenkins include that it is open source and built in Java. With this in mind, it is deducible that it is cross-platform and that you can use it in many environments.
Let’s get started.
Installing Jenkins on Rocky Linux 9 / Alma Linux 9
Preparing the server for Jenkins
First, access via SSH to the server and then update it
sudo dnf update
The next step is to install some DNF utilities.
sudo dnf install dnf-utils
Then enable the EPEL repository
sudo dnf install epel-release
Next, install Java from the official repositories.
sudo dnf install java-11-openjdk java-11-openjdk-devel
Confirm the Java version by running
java -version
Sample Output:
openjdk version "11.0.16.1" 2022-08-12 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.1.1-1.el9_0) (build 11.0.16.1+1-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.1.1-1.el9_0) (build 11.0.16.1+1-LTS, mixed mode, sharing)
Add Jenkins repository
An interesting way to install Jenkins is to do it via the repositories they provide for Rocky Linux 9 / Alma Linux 9
Add the repository
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
Then the GPG key of it
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
Installing Jenkins on Rocky Linux 9 / Alma Linux 9
With the repository added, you can now install Jenkins
sudo dnf install jenkins
When the installation is finished, you can start it and enable it to start with the system
sudo systemctl enable --now jenkins
Then, check the status of the service
sudo systemctl status jenkins
Don’t forget to set the rules in the firewall properly so that Jenkins is accessible.
sudo firewall-cmd --add-port=8080/tcp --zone=public --permanent
sudo firewall-cmd --reload
Yes, Jenkins works via port 8080
Completing the Jenkins installation
Now open your favorite web browser and go to http://your-server:8080
to complete the installation. You will initially see this page.
You will be prompted for a secure password, which you can obtain by running
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
In my case, it has generated this password
f761be808cd048c6aef6b88586b105eb
Copy and paste it, and you will be able to continue.
Then, you will be prompted to choose to install the suggested plugins or select the ones you want.
The rest of the steps are to install the plugins, create a new user with your password and verify the Jenkins URL. Finally, you will see the dashboard.
Conclusion
In this post, you learned how to install Jenkins on Rocky Linux 9 / Alma Linux 9 using the official developer repositories.