Install and Configure Jenkins on AlmaLinux 9 | Easy Guide
In this guide, we will walk you through the process to Install and Configure Jenkins on AlmaLinux 9. Jenkins is a powerful, open-source automation server written in Java. It provides continuous integration and continuous delivery (CI/CD) services for software development. By automating the build, test, and deployment phases, Jenkins streamlines the software development lifecycle, making it easier for developers and DevOps engineers to integrate changes and release new builds.
Let’s get started with Install and Configure Jenkins on AlmaLinux 9 on your server.
Before you begin, ensure you are logged in to your AlmaLinux 9 server as a non-root user with sudo privileges. If you haven’t already configured this, you can refer to a guide on initial server setup with AlmaLinux 9.
1. Install OpenJDK for Jenkins Setup
Since Jenkins is a Java-based application, you need to install a Java Development Kit (JDK) on your server. We’ll use OpenJDK 11, a supported version for Jenkins.
First, update your package index:
sudo dnf update -y
Next, install OpenJDK 11:
sudo dnf install java-11-openjdk -y
Verify the installation by checking the Java version:
java -version
**Output**
openjdk version "11.0.18" 2023-01-17 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.18.0.10-2.el9_1) (build 11.0.18+10-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.10-2.el9_1) (build 11.0.18+10-LTS, mixed mode, sharing)
2. Set up Jenkins on AlmaLinux 9
Now, let’s configure Jenkins by adding its repository, updating the system, installing the software, and managing the Jenkins service.
Add Jenkins Repository and GPG Key
Add the Jenkins repository to your AlmaLinux server using the following commands:
sudo wget -O /etc/yum.repos.d/jenkins.repo
https://pkg.jenkins.io/redhat/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
Run System Update
Update the system to recognize the new repository:
sudo dnf update -y
Jenkins Installation on AlmaLinux 9
Install Jenkins using the following command:
sudo dnf install jenkins -y
Manage Jenkins Service
After the installation, start and enable the Jenkins service:
sudo systemctl enable jenkins
sudo systemctl start jenkins
Verify that the service is running:
sudo systemctl status jenkins
**Output**
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor p>
Active: **active** (**running**) since Sun 2023-04-16 03:42:12 EDT; 8s ago
Main PID: 65992 (java)
Tasks: 48 (limit: 23609)
Memory: 1.1G
CPU: 1min 13.235s
CGroup: /system.slice/jenkins.service
└─65992 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jav>
Jenkins Administrator password
Retrieve the initial administrator password, which is required to access the Jenkins web interface. It’s located in the /var/lib/jenkins/secrets/initialAdminPassword
file:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
**Output**
fd30b25b15dc4379b322ab68a1d9a235
Configure Firewall for Jenkins
If you’re using firewalld, configure it to allow access to Jenkins. The default port is 8080.
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
3. Configure Jenkins through the Web Interface
Access the Jenkins web interface by navigating to your server’s IP address followed by port 8080 in your web browser:
http://<your-server-ip>:8080
You’ll be prompted to unlock Jenkins. Enter the initial admin password you retrieved earlier and click Continue.

Next, you can choose to install suggested plugins or select specific plugins. Click Install suggested plugins.

After the plugins are installed, create your first admin user.

4. Access Jenkins Dashboard on AlmaLinux 9
After completing the configuration steps, you’ll be redirected to the Jenkins dashboard, where you can start creating projects and pipelines.


You should now see the Jenkins dashboard, ready for use.

For more detailed information, refer to the Jenkins Docs.
Conclusion
You have successfully learned to Install and Configure Jenkins on AlmaLinux 9. This setup enables you to streamline your software development process through continuous integration and delivery.
Alternative Solutions for Installing Jenkins on AlmaLinux 9
While the above method using the official Jenkins repository is standard and reliable, here are two alternative approaches you can consider:
1. Installing Jenkins via Docker
Docker provides a containerized environment that simplifies application deployment and management. You can Install and Configure Jenkins on AlmaLinux 9 using Docker.
Explanation:
This method involves pulling the official Jenkins Docker image from Docker Hub and running it as a container. This approach isolates Jenkins and its dependencies within the container, ensuring consistency across different environments and simplifying updates.
Steps:
-
Install Docker:
If Docker isn’t already installed, install it:
sudo dnf install docker -y sudo systemctl start docker sudo systemctl enable docker
-
Pull the Jenkins Image:
Pull the official Jenkins image from Docker Hub:
sudo docker pull jenkins/jenkins:lts
-
Run the Jenkins Container:
Run the Jenkins container, mapping port 8080 on the host to port 8080 in the container, and mapping a volume for persistent storage of Jenkins data:
sudo docker run -d -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
-d
: Runs the container in detached mode (background).-p 8080:8080
: Maps port 8080 on the host to port 8080 in the container (Jenkins web interface).-p 50000:50000
: Maps port 50000 on the host to port 50000 in the container (for Jenkins agents).-v jenkins_home:/var/jenkins_home
: Creates a named volumejenkins_home
and mounts it to/var/jenkins_home
inside the container for persistent storage of Jenkins data.
-
Access Jenkins:
Access Jenkins through your web browser at
http://<your-server-ip>:8080
. Retrieve the initial admin password using:sudo docker exec <container_id> cat /var/jenkins_home/secrets/initialAdminPassword
Replace
<container_id>
with the ID of your Jenkins container (you can find it usingsudo docker ps
).
2. Using a Configuration Management Tool (Ansible)
Automating the installation and configuration with a configuration management tool like Ansible is another viable option. This is useful for managing multiple Jenkins instances or ensuring consistency across deployments.
Explanation:
Ansible allows you to define the desired state of your system in a playbook. The playbook will then automatically execute the necessary steps to achieve that state, ensuring that Jenkins is installed and configured consistently across multiple servers.
Steps:
-
Install Ansible:
If Ansible is not already installed, install it on your control machine:
sudo dnf install ansible -y
-
Create an Ansible Playbook:
Create a YAML file (e.g.,
jenkins_install.yml
) containing the following playbook:--- - hosts: all become: true tasks: - name: Install OpenJDK 11 dnf: name: java-11-openjdk state: present - name: Add Jenkins repository get_url: url: https://pkg.jenkins.io/redhat/jenkins.repo dest: /etc/yum.repos.d/jenkins.repo - name: Import Jenkins GPG key rpm_key: state: present key: https://pkg.jenkins.io/redhat/jenkins.io-2023.key - name: Install Jenkins dnf: name: jenkins state: present notify: Restart Jenkins - name: Enable and start Jenkins service systemd: name: jenkins enabled: yes state: started - name: Allow Jenkins through the firewall firewalld: service: http permanent: true state: enabled immediate: yes handlers: - name: Restart Jenkins systemd: name: jenkins state: restarted
-
Run the Playbook:
Execute the playbook against your target AlmaLinux 9 server:
ansible-playbook -i <inventory_file> jenkins_install.yml
Replace
<inventory_file>
with the path to your Ansible inventory file, which contains the IP address or hostname of your AlmaLinux 9 server.
These alternative solutions offer different benefits and are suitable for various scenarios. Docker simplifies deployment and isolation, while Ansible provides powerful automation and configuration management capabilities. You can choose the method that best fits your needs for Install and Configure Jenkins on AlmaLinux 9.