UbuntuUbuntu Based

How To Install Jenkins on Ubuntu 24.04 LTS

Install Jenkins on Ubuntu 24.04

In this tutorial, we will show you how to install Jenkins on Ubuntu 24.04 LTS. Jenkins is a powerful open-source automation server that streamlines the process of building, testing, and deploying software. It has become an essential tool for developers and DevOps teams looking to implement continuous integration and continuous delivery (CI/CD) pipelines.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Jenkins on Ubuntu 24.04 (Noble Numbat). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.

Prerequisites

  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • Basic knowledge of the Linux command line.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install Jenkins on Ubuntu 24.04

Step 1. Update Your System.

To ensure a smooth installation, it’s essential to update your Ubuntu system to the latest stable release. Open your terminal and run the following commands:

sudo apt update
sudo apt upgrade

This will fetch the latest package information and upgrade any outdated packages to their newest versions.

Step 2. Installing Java.

Jenkins is a Java-based application, so the first step is to install Java on your Ubuntu system. OpenJDK 17 is recommended for optimal compatibility and performance. To install OpenJDK 17, open a terminal and run the following commands:

sudo apt update
sudo apt install openjdk-17-jre

Once the installation is complete, verify the Java version by running:

java --version

You should see the installed Java version displayed in the terminal output.

Step 3. Installing Jenkins.

To ensure that you have access to the latest Jenkins packages, you need to add the Jenkins APT repository to your system. Follow these steps:

Download the Jenkins repository key:

sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key

Add the Jenkins repository to your system’s sources list:

echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/" | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

With the Jenkins repository added, you can now proceed with the installation. Update the package lists and install Jenkins using the following commands:

sudo apt update
sudo apt install jenkins

After the installation is completed, Jenkins will automatically start as a systemd service. To confirm this, run the command:

sudo systemctl status jenkins

Step 4. Configure Firewall Rules for Jenkins.

By default, Jenkins listens on port 8080. To allow external access to the Jenkins web interface, you need to configure your firewall rules accordingly. If you have UFW (Uncomplicated Firewall) enabled, run the following commands:

sudo ufw allow 8080
sudo ufw enable
sudo ufw status

This will open port 8080 and enable the firewall, allowing access to the Jenkins web interface.

Step 5. Access Jenkins Web Interface.

To access the Jenkins web interface, open a web browser and navigate to http://<your-server-ip>:8080. Replace <your-server-ip> with the IP address or domain name of your Ubuntu server.

On the initial setup page, you’ll be prompted to unlock Jenkins by providing an administrator password. To retrieve the password, run the following command in the terminal:

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

Copy the password and paste it into the “Administrator password” field on the Jenkins web interface. Click “Continue” to proceed.

Install Jenkins on Ubuntu 24.04

Congratulations! You have successfully installed Jenkins. Thanks for using this tutorial for installing Jenkins on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the Jenkins website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button