# 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](https://www.jenkins.io/) 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 Recommendat](https://www.jenkins.io/doc/book/scaling/hardware-recommendations/)[ions.](https://www.jenkins.io/doc/book/scaling/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/](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.

```bash
$ sudo apt update
```

```bash
$ sudo apt install fontconfig openjdk-21-jre
```

```bash
$ java -version
```

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

```bash
$ 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:

```bash
$ 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:

```bash
$ 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

```bash
$ sudo apt update
```

```bash
$ sudo apt install jenkins
```

### Managing the Service

```bash
$ sudo systemctl start jenkins
```

```bash
$ sudo systemctl enable jenkins
```

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

```bash
$ sudo systemctl status jenkins
```

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

```bash
$ 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.

```bash
$ 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:

```bash
$ sudo ufw allow OpenSSH
Rules updated
Rules updated (v6)
```

```bash
$ 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:

```bash
$  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.
        

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1767316738498/87032aef-5246-4b5e-9621-68254325911c.png align="center")

2. Return to your terminal to retrieve the automatically generated initial password:
    

```bash
$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
b80XXXXXXXXXXXXXXXXXXXX 
```

3. Copy the alphanumeric string from the terminal, paste it into the browser field, and click **Continue**.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1767316940367/edbe029b-d4bc-4964-9d47-7e3b0534f369.png align="center")

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1767317042958/d600b2ed-0712-4665-9900-076ddeaa5a22.png align="center")

5. **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:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1767317251151/3cc3740d-7cf6-411c-ac2f-ac1099867df6.png align="center")

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.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1767317323361/dbb5fb6f-eaff-412f-9710-75e422af0447.png align="center")

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1767317414592/7c9b771e-b0df-4522-b4ae-9f438b06b1f2.png align="center")

Click **Start using Jenkins** to visit the main Jenkins dashboard:

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1767317479236/2a1e36e5-4523-431c-903e-2d8c1aca8bb2.png align="center")

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