How to Install Jenkins on AlmaLinux 9.2

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.

How to Install Jenkins on Alma Linux 9.2 - 0 - Add Non-Root User

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).

How to Install Jenkins on Alma Linux 9.2 - 1 - Login as Non-Root User

Step 2 – Update the system

Ensure the system is up-to-date.

sudo dnf upgrade

How to Install Jenkins on Alma Linux 9.2 - 2 - dnf upgrade

Step 3 – Install JAVA

Install JAVA as it is required for Jenkins.

sudo dnf install java-17-openjdk

How to Install Jenkins on Alma Linux 9.2 - 3 - Install Java

Verify JAVA is installed.

java --version

How to Install Jenkins on Alma Linux 9.2 - 4 - 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

How to Install Jenkins on Alma Linux 9.2 - 5 - Install Jenkins

If a “command not found” error is encountered for any of the commands above, simply install the required package. For example…

How to Install Jenkins on Alma Linux 9.2 - 6 - Install wget

Step 5 – Start Jenkins

Ensure Jenkins is successfully started.

sudo systemctl daemon-reload
sudo systemctl start jenkins
sudo systemctl status jenkins

How to Install Jenkins on Alma Linux 9.2 - 7 - Start Jenkins

Step 6 – Access Jenkins

Access the Jenkins Web FrontEnd at http://ServerIP:8080.

How to Install Jenkins on Alma Linux 9.2 - 9 - Access Jenkinws

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

How to Install Jenkins on Alma Linux 9.2 - 10 - Get Jenkins Initial Password

If entered correctly, you should see the following “Getting Started | Customize Jenkins” screen.

How to Install Jenkins on Alma Linux 9.2 - 11 - Get Jenkins Initial Password
You are done!

Leave a Reply

Your email address will not be published. Required fields are marked *