INTRODUCTION
Jenkins is an open-source CI/CD automation server used to automate building, testing, and deploying applications. As a Java-based service, Jenkins runs continuously and integrates with a wide range of development and DevOps tools.
In this tutorial, you will install Jenkins on Ubuntu using the official Jenkins APT repository, start and verify the Jenkins service, open firewall access on port 8080, and complete the initial web-based setup by creating an administrative user. You will also learn how to troubleshoot common issues such as Java version incompatibilities, service startup failures, and port conflicts.
By the end of this guide, you will have a working Jenkins installation for development and testing. Because Jenkins is not secure by default, the tutorial also highlights key security considerations to address before using Jenkins in production environments.
Key Takeaways:
Jenkins is a Java-based CI/CD automation server, and Java 17 or later is required for Jenkins to install and run correctly on Ubuntu.
To install the latest stable Jenkins version on Ubuntu, you should add the official Jenkins APT repository, as Ubuntu’s default repository often provides outdated releases.
Jenkins runs as a
systemdservice on Ubuntu, allowing administrators to manage it easily usingsystemctl start,stop,restart, andstatus.By default, Jenkins listens on port
8080, which must be opened in the UFW firewall to access the Jenkins web interface from a browser.During first-time setup, Jenkins must be unlocked using the initial admin password located at
/var/lib/jenkins/secrets/initialAdminPassword.Installing the recommended Jenkins plugins during setup provides essential functionality and is the fastest way to get a working CI/CD environment.
A default Jenkins installation on Ubuntu is not secure for production use and should be hardened with authentication, HTTPS via a reverse proxy, and restricted network access.
Most Jenkins installation and startup issues, such as service failures, port conflicts, or inaccessible web UI can be resolved by checking Java compatibility, firewall rules, and Jenkins system logs.
Prerequisites
To follow this tutorial, you will need:
One Ubuntu server configured with a non-root sudo user and firewall by following the Initial Server Setup with Ubuntu guide. We recommend starting with at least 1 GB of RAM. Visit Jenkins’s “Hardware Recommendations” for guidance in planning the capacity of a production-level Jenkins installation.
OpenJDK 17 or higher installed, following our guidelines on installing specific versions of OpenJDK on Ubuntu.
Step 1 — Installing Jenkins
The version of Jenkins available in the default Ubuntu repositories is often behind the version maintained by the Jenkins project. To install a more current and actively maintained release, we will add the official Jenkins repository and install Jenkins from there.
Start by downloading the Jenkins repository signing key and storing it in the system keyrings directory:
sudo mkdir -p /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io-2026.keyThis command retrieves the Jenkins GPG key and saves it in /etc/apt/keyrings, which is the recommended location for repository keys on modern Ubuntu systems.
Next, add the Jenkins Debian 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/nullThe signed-by option instructs apt to verify packages from this repository using the specific GPG key you downloaded earlier. This limits trust to only this repository and avoids using a system-wide key.
After adding the repository, update the local package index so apt can recognize the new source:
sudo apt updateFinally, install Jenkins and its required dependencies:
sudo apt install jenkinsOnce the installation completes, Jenkins is installed on the system but the service is not yet running. In the next step, you will start the Jenkins service and verify that it is working correctly.
Step 2 — Starting Jenkins
Now that Jenkins is installed, start it using systemctl:
sudo systemctl start jenkins.serviceSince systemctl does not display status output, we’ll use the status command to verify that Jenkins started successfully:
sudo systemctl status jenkinsIf everything went well, the beginning of the status output shows that the service is active and configured to start at boot:
Output● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-02-05 06:20:00 UTC; 29s ago
Main PID: 2292 (java)
Tasks: 50 (limit: 4655)
Memory: 718.8M (peak: 719.6M)
CPU: 27.378s
CGroup: /system.slice/jenkins.service
└─2292 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.warNow that Jenkins is up and running, adjust your firewall rules so that you can reach it from a web browser to complete the initial setup.
Step 3 — Opening The Firewall
To set up a UFW firewall, check out Step 4 - Setting up a Basic Firewall of our Initial Server Setup with Ubuntu guide. By default, Jenkins runs on port 8080. Open that port using ufw:
sudo ufw allow 8080Note: If the firewall is inactive, the following commands will allow OpenSSH and enable the firewall:
sudo ufw allow OpenSSH sudo ufw enable
Check ufw’s status to confirm the new rules:
sudo ufw statusYou’ll notice that traffic is allowed to port 8080 from anywhere:
OutputStatus: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
8080 ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)With Jenkins installed and a firewall configured, you have completed the installation stage and can continue with configuring Jenkins.
