How to install the Jenkins CI/CD platform on Rocky Linux

How to install the Jenkins CI/CD platform on Rocky Linux

Jenkins is a platform aimed at making Continuous Delivery and Continuous Integration not only possible but much easier. Find out how to install it on Rocky Linux.

Logos of the open source desktop and server operating system Linux on a heap on a table.
Image: Andreas Prott/Adobe Stock

For any company looking to make agile development a reality, there are certain tools you’ll want to make available for your teams. One such tool is Jenkins, which supports more than 1,000 plugins for the building, deploying and automating of agile projects.

SEE: Hiring kit: Back-end Developer (TechRepublic Premium)

The key features of Jenkins include deployment-ready staging, extensibility, test customization, third-party integrations, process, workflow management, configuration management, reporting, access control and automation.

In this tutorial, I’ll walk you through how to install Jenkins on Rocky Linux 9. The installation is relatively straightforward and shouldn’t take more than five to 10 minutes.

What you’ll need to install Jenkins

To follow along, you’ll need a running instance of Rocky Linux 9 and a user with sudo privileges. That’s it.

How to set your time zone

The first thing we want to do is make sure your Rocky Linux server is in the right time zone. To check, log into your instance of Rocky Linux and view the list of time zones with this command:

timedatectl list-timezones

Now, find your timezone in this list and set it with the following, where TIMEZONE is the correct time zone for your area:

sudo timedatectl set-timezone TIMEZONE

How to install the necessary dependencies

Next, we’re going to install the required dependencies. Start by opening a terminal window and installing Java OpenJDK with this command:

sudo dnf install java-11-openjdk -y

Next, install wget and curl with this command:

sudo dnf install wget curl -y

How to install the Jenkins repository

We now need to add the official Jenkins repository with the following:

sudo wget -O /etc/yum.repos.d/jenkins.repo

Now, to import the Jenkins GPG key, use this:

sudo rpm --import 

How to install Jenkins

You can now install Jenkins with this command:

sudo dnf install jenkins -y

When installation finishes, reload the systemctl daemon with this command:

sudo systemctl daemon-reload

Now, you can start and enable the service with:

sudo systemctl enable --now jenkins

If you’re not already allowing HTTP traffic through the firewall, enable this now with the following commands:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload

How to access Jenkins

It’s time to access the platform by pointing your web browser to http://SERVER:8080, where SERVER is the IP address or domain of the hosting server. You will be prompted to enter the admin password, which can be retrieved by running this command:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Now, copy and paste that password into the Administrator password field (Figure A).

Figure A

Unlocking Jenkins with the password you copied from the cat command.
Unlocking Jenkins with the password you copied from the cat command.

You will then be prompted to install plugins. I recommend you click Install Suggested Plugins to get the most commonly-used plugins. After clicking Install Suggested Plugins, the installation will take a few minutes to finalize, but you’ll eventually be prompted to create an admin user (Figure B).

Figure B

Make sure to create a strong password for your admin user.
Make sure to create a strong password for your admin user.

Once you create the admin user, you’ll be presented with the Jenkins main page, where you can start adding your projects.

Agility at your fingertips

Agile development is challenging, so any tool you can get to simplify the process should be a must for your developers. If you want agility at your fingertips, Jenkins is a great place to start.

Looking for additional tips and tricks for development on Linux operating systems? Check out our guide, 8 must-have tools for developers on Linux.

Source of Article