Skip to main content

Command Palette

Search for a command to run...

How To Install Jenkins on Ubuntu 24.04

Updated
5 min read
How To Install Jenkins on Ubuntu 24.04

Introduction

In the landscape of modern DevOps, automation is not a luxury—it is a necessity. Jenkins stands as the cornerstone of this ecosystem. As the world’s leading open-source automation server, Jenkins empowers development teams to orchestrate their entire software delivery lifecycle, from continuous integration (CI) to complex continuous delivery (CD) pipelines.

While newer CI tools have entered the market, Jenkins remains the industry standard due to its unmatched flexibility. Its vast plugin architecture allows it to integrate with virtually every tool in the software stack, including Docker, Kubernetes, and Git. By hosting Jenkins on a DigitalOcean Droplet, you gain a performant, cost-effective, and fully customizable environment—free from the "build minute" quotas and constraints of managed services.

Prerequisites

Before we begin, ensure you have the following:

  • One Ubuntu 24.04 server: Set up with a non-root sudo user and a configured firewall.
  • Hardware Note: While Jenkins can technically run on 1 GB of RAM, it is memory-intensive. For a stable production experience, we recommend a Droplet with at least 2 GB to 4 GB of RAM. For larger deployments, consult the official Jenkins Hardware Recommendations.

Each build node connection will take 2-3 threads, which equals about 2 MB or more of memory. You will also need to factor in CPU overhead for Jenkins if there are a lot of users who will be accessing the Jenkins user interface. [https://www.jenkins.io/doc/book/scaling/hardware-recommendations/]

⚠️ Critical Dependency Order On Debian and Ubuntu systems, the order of operations is vital. You must install the Java Runtime Environment (JRE) before installing the Jenkins package.

If you attempt to install Jenkins first, the service will attempt to start immediately, fail to locate a JVM, and crash with a failed to find a valid Java installation error. Installing Java first ensures the environment is primed for a successful first boot.

Step 1 - Installing Java Runtime

Jenkins is a Java application. As of 2025/2026, the Jenkins project has shifted its primary support and recommendations toward newer Long Term Support (LTS) releases of Java. While many legacy guides suggest Java 11, we will install OpenJDK 21 to future-proof your environment and improve garbage collection performance.

$ sudo apt update
$ sudo apt install fontconfig openjdk-21-jre
$ java -version

If the installation was successful, you should see an output similar to the following:

$ java -version
openjdk version "21.0.9" 2025-10-21
OpenJDK Runtime Environment (build 21.0.9+10-Ubuntu-124.04)
OpenJDK 64-Bit Server VM (build 21.0.9+10-Ubuntu-124.04, mixed mode, sharing)

Step 2 - Configuring the Jenkins Repository

By default, the Ubuntu repositories usually lag behind the official Jenkins release cycle. To ensure we get the latest stable features and security patches, we will use the official Debian-stable repository maintained by the Jenkins project.

2.1 Add the GPG Key

We must authenticate the packages to ensure they haven't been tampered with. Download the signed key to your system's keyring:

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

--2026-01-02 01:07:17--  https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
Resolving pkg.jenkins.io (pkg.jenkins.io)... 199.232.114.133, 2a04:4e42:5c::645
Connecting to pkg.jenkins.io (pkg.jenkins.io)|199.232.114.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3175 (3.1K) [application/octet-stream]
Saving to: ‘/usr/share/keyrings/jenkins-keyring.asc’

/usr/share/keyrings/jenkins-keyring.a 100%[=======================================================================>]   3.10K  --.-KB/s    in 0s      

2026-01-02 01:07:17 (37.8 MB/s) - ‘/usr/share/keyrings/jenkins-keyring.asc’ saved [3175/3175]

2.2 Add the Repository Source

Now, add the repository URL to your system's source list. We use the signed-by tag to strictly enforce security using the key we just downloaded:

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

Step 3: Installing and Starting Jenkins

$ sudo apt update
$ sudo apt install jenkins

Managing the Service

$ sudo systemctl start jenkins
$ sudo systemctl enable jenkins

You can verify the service is healthy and active by running:

$ sudo systemctl status jenkins

If successful, you will see an active (running) status in green.

$ sudo systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
     Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; preset: enabled)
     Active: active (running) since Fri 2026-01-02 01:10:56 UTC; 27s ag

Step 4: Securing Network Access (UFW)

DigitalOcean Droplets often come with ufw (Uncomplicated Firewall) configured. By default, Jenkins listens on port 8080, which is likely blocked.

We need to explicitly allow traffic on this port to access the dashboard.

$ sudo ufw allow 8080
Rules updated
Rules updated (v6)

Note: If the firewall is inactive, the following commands will allow OpenSSH and enable the firewall:

$ sudo ufw allow OpenSSH
Rules updated
Rules updated (v6)
$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup

To confirm the rule is active:

$  sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
8080                       ALLOW       Anywhere                  
OpenSSH                    ALLOW       Anywhere                  
8080 (v6)                  ALLOW       Anywhere (v6)             
OpenSSH (v6)               ALLOW       Anywhere (v6)

Step 5: The Post-Installation Setup

Now that the backend is running, we move to the browser to complete the setup.

  1. Open your web browser and navigate to: http://<your_server_ip>:8080

    • You will be greeted by the Unlock Jenkins screen. This is a security measure to ensure you are the server administrator.

  1. Return to your terminal to retrieve the automatically generated initial password:
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
b80XXXXXXXXXXXXXXXXXXXX
  1. Copy the alphanumeric string from the terminal, paste it into the browser field, and click Continue.

  1. Select "Install suggested plugins". This installs the "Greatest Hits" of Jenkins (Git, Pipeline, basic UI features) and is the best starting point.

  1. Create Admin User: Once the plugins finish downloading, create your primary admin account. Do not use the default "admin" user; create a specific user for yourself.

Enter the name, password and email for your user:

The final step is the Instance Configuration. You will be asked to define the root URL for your Jenkins installation. Ensure the field reflects the correct public IP address or domain name of your server.

After confirming the appropriate information, click Save and Finish. You’ll receive a confirmation page confirming that “Jenkins is Ready!”:

Click Start using Jenkins to visit the main Jenkins dashboard:

Conclusion

You have successfully deployed a modern Jenkins environment on DigitalOcean. You now have a powerful automation server ready to connect to your Git repositories and start building pipelines.

How to Install Jenkins on Ubuntu 24.04: A Step-by-Step Guide