In this guide we demonstrate how to install Jenkins on AlmaLinux 9.2. Please note that this procedure may or may not work for other versions of AlmaLinux. Let’s dive in…
Jenkins is an open-source automation server that helps automate parts of software development related to building, testing and deployment. We will now demonstrate how to install Jenkins on AlmaLinux 9.2.
How to Install Jenkins on AlmaLinux 9.2
Prerequisites
To follow this guide, you will need the following:
- A LinuxAlma 9.2 server installation.
- A non-root user with sudo privileges.
- To add a a non-root user with sudo privileges, issue the following commands (as root user):
useradd -m -d /home/jenkinsuser -s /bin/bash -U jenkinsuser
passwd jenkinsuser
touch /etc/sudoers.d/jenkinsuser
echo 'jenkinsuser ALL=(ALL:ALL) NOPASSWD:ALL'> /etc/sudoers.d/jenkinsuser
Note: The last line (echo ‘jenkinsuser
…’) is optional and should only be run if you want to run sudo commands without getting prompted to enter a password. This is also a more insecure way to operate so run at your own discretion based on your environment.
Step 1 – Log in to AlmaLinux as a Non-Root Sudo User
Using Putty, SSH into AlmaLinux and log in as a non-root sudo user (i.e. jenkinsuser
).
Step 2 – Update the system
Ensure the system is up-to-date.
sudo dnf upgrade
Step 3 – Install JAVA
Install JAVA as it is required for Jenkins.
sudo dnf install java-17-openjdk
Verify JAVA is installed.
java --version
Step 4 – Install Jenkins
Add the Jenkins repository.
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
Install the GPG signing key.
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
Install Jenkins.
sudo dnf install jenkins
If a “command not found” error is encountered for any of the commands above, simply install the required package. For example…
Step 5 – Start Jenkins
Ensure Jenkins is successfully started.
sudo systemctl daemon-reload
sudo systemctl start jenkins
sudo systemctl status jenkins
Step 6 – Access Jenkins
Access the Jenkins Web FrontEnd at http://ServerIP:8080.
The initial administrator password can be retrieved by running the following command on AlmaLinux. Simply copy/paste it into the Administrator password field.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
If entered correctly, you should see the following “Getting Started | Customize Jenkins” screen.