How to Install Jenkins on Ubuntu 24.04 LTS
Complete guide to install Jenkins on Ubuntu 24.04 LTS using the official repository, OpenJDK 17, UFW firewall rules, and web setup wizard.

5 min read
Complete guide to install Jenkins on Ubuntu 24.04 LTS using the official repository, OpenJDK 17, UFW firewall rules, and web setup wizard.
- Prerequisites and Supported Releases
- Step 1: Installing the Required Java 17 OpenJDK Runtime
- Step 2: Adding the Official Jenkins GPG Repository Key
Continuous Integration and Continuous Deployment (CI/CD) pipelines serve as the backbone of high-velocity software engineering teams. When you install jenkins on ubuntu 24.04, you deploy an enterprise-ready automation engine supported by thousands of community plugins capable of orchestrating build jobs, automated test suites, container publishing, and production server rollouts.
Jenkins is a Java-based application that requires an active Long-Term Support (LTS) Java Development Kit runtime. Modern releases of Jenkins (version 2.440+) require Java 17 or Java 21. This guide walks you through installing OpenJDK 17, adding the official Jenkins Debian repository with secure GPG keyrings, configuring background systemd services, opening firewall ports, and completing initial setup.
Jenkins is the premier open-source automation server for building, testing, and deploying modern software. This tutorial guides you through how to install Jenkins on Ubuntu 24.04 LTS, configure the required Java 17 OpenJDK runtime, set up the official Jenkins Debian repository with GPG signing, configure UFW firewall rules, and unlock the web administrative dashboard.
Prerequisites and Supported Releases
This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat) & Ubuntu 22.04 LTS. The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.
Before proceeding, ensure you have the following requirements satisfied:
- A server running Ubuntu 24.04 LTS with at least 2 GB of RAM (4 GB or more recommended for CI build pipelines).
- A user account with active sudo administrative privileges.
- An active Internet connection to download packages and Jenkins plugins.
- Port 8080 open on your cloud firewall or security group.
Step 1: Installing the Required Java 17 OpenJDK Runtime
Because Jenkins runs inside a Java Virtual Machine (JVM), you must install an approved Java LTS runtime prior to installing the Jenkins packages.
Ubuntu 24.04 provides OpenJDK 17 and OpenJDK 21 in its standard repositories. Install openjdk-17-jdk using APT.
# Refresh package index
sudo apt update
# Install OpenJDK 17 JDK and JRE packages
sudo apt install -y openjdk-17-jdk openjdk-17-jre
# Verify the installed Java version
java -version
# Sample output:
# openjdk version "17.0.12" 2024-07-16
# OpenJDK Runtime Environment (build 17.0.12+7-Ubuntu-1ubuntu224.04)
# OpenJDK 64-Bit Server VM (build 17.0.12+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)
Step 2: Adding the Official Jenkins GPG Repository Key
To ensure you receive authentic, signed packages and continuous security updates directly from the Jenkins core project, install the official Jenkins Debian repository.
Download and dearmor the Jenkins project GPG public key into /etc/apt/keyrings/jenkins-keyring.asc, adhering strictly to Ubuntu 24.04 repository standards.
# Ensure the keyrings directory exists
sudo install -m 0755 -d /etc/apt/keyrings
# Download the Jenkins GPG key into keyrings
sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
# Ensure secure read permissions
sudo chmod 0644 /etc/apt/keyrings/jenkins-keyring.asc
Step 3: Configuring the Jenkins Debian Package Repository
Create a dedicated source definition file for the Jenkins weekly or LTS release channel in /etc/apt/sources.list.d/jenkins.list.
Configure the source file to reference the GPG keyring using the signed-by directive.
# Add the Jenkins LTS repository to your APT sources
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 4: Installing Jenkins via APT
The installation script automatically registers a dedicated system user and group named jenkins, creates data directories under /var/lib/jenkins, writes logs to /var/log/jenkins/, and creates a systemd service unit.
# Update package metadata
sudo apt update
# Install Jenkins
sudo apt install -y jenkins
Step 5: Starting and Verifying the Jenkins Systemd Service
Confirm that the status output indicates Active: active (running). Jenkins typically requires between 15 to 45 seconds to initialize its internal database and plugin dependencies on first launch.
# Start and enable Jenkins service
sudo systemctl enable --now jenkins
# Inspect service status
sudo systemctl status jenkins
Step 6: Configuring UFW Firewall for Port 8080
By default, Jenkins listens for HTTP web traffic on TCP port 8080. If you have Uncomplicated Firewall (UFW) active on your server, you must permit traffic on this port.
Open port 8080 and verify firewall rules.
# Allow incoming traffic on port 8080
sudo ufw allow 8080/tcp
# Reload and check UFW status
sudo ufw reload
sudo ufw status
Step 7: Unlocking Jenkins and Completing the Web Setup Wizard
Copy this password, paste it into the Administrator password field in your browser, and click Continue.
On the next screen, choose Install suggested plugins. Jenkins will automatically download and install foundational plugins for Git, Pipeline, SSH agents, and authentication. Once complete, create your first administrative user and confirm the instance URL.
For enterprise stability, never run resource-intensive build or test jobs directly on the Jenkins controller node. Navigate to Manage Jenkins > Nodes to configure dedicated distributed build agents (such as ephemeral Docker containers or SSH-connected worker VMs). This keeps your automation controller responsive even during massive compilation workloads.
# Retrieve the initial Jenkins administrator password
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
# Sample password:
# 4a8e2b9c7d1f43a59e1208b6d3c9f7a1
Troubleshooting and Common Errors
When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:
Jenkins fails to start with 'UnsupportedClassVersionError'.
Cause: Jenkins was executed using an unsupported legacy Java version (e.g. Java 8 or Java 11).
Resolution: Ensure Java 17 or 21 is set as the system default using sudo update-alternatives --config java.
sudo update-alternatives --config java
Web browser displays 'Site cannot be reached' on port 8080.
Cause: Cloud provider security groups (AWS, GCP, DigitalOcean) or UFW are blocking incoming traffic on TCP port 8080.
Resolution: Check that Jenkins is listening on all interfaces (ss -tulpn | grep 8080) and ensure port 8080 is allowed in your hosting firewall.
sudo ss -tulpn | grep 8080
Jenkins builds fail with out-of-memory (OOM) errors.
Cause: The default JVM heap allocation is insufficient for heavy concurrent build pipelines.
Resolution: Override JVM heap arguments by creating a drop-in systemd configuration with sudo systemctl edit jenkins and setting JAVA_OPTS=-Xms512m -Xmx2048m.
sudo systemctl edit jenkins
Security Best Practices and Hardening
Never leave port 8080 exposed directly to the public Internet without TLS encryption.
In production environments, place Jenkins behind an Nginx reverse proxy with Let's Encrypt SSL/TLS, and enforce role-based access control (RBAC).
Regularly review installed plugins and update them immediately through the Plugin Manager to mitigate remote code execution (RCE) advisories.
Always store sensitive API tokens, GitHub personal access tokens, and SSH deployment keys inside Jenkins Credentials Manager rather than hardcoding them in pipeline files.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
- How to Install Java on Ubuntu 24.04 — Explore OpenJDK installation, multiple Java version management, and
JAVA_HOMEsetup. - How to Install Nginx on Ubuntu 24.04 — Deploy Nginx as a secure reverse proxy in front of your Jenkins automation server.
- How to Set Up a Firewall with UFW on Ubuntu — Configure network security rules and restrict port 8080 access to trusted CIDR blocks.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
jenkins/jenkins:lts). However, installing directly on Ubuntu gives you native systemd service integration and direct access to host build tools.sudo systemctl edit jenkins and add [Service] followed by Environment="JENKINS_PORT=9090". Reload systemd and restart Jenkins.sudo apt update && sudo apt --only-upgrade install jenkins./var/lib/jenkins/ directory.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides
Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!