How to install Jenkins on Ubuntu 20.04

Jenkins is an open source automation server that can be used to easily set up continuous integration and continuous delivery (CI / CD) pipelines.

Continuous Integration (CI) is a DevOps practice where team members regularly commit their code changes to a version control repository, after which automated builds and tests are run. Continuous Delivery (CD) is a series of practices in which code changes are automatically generated, tested, and deployed to production.

Jenkins can be installed as a standalone application, as a servlet in a Java Servlet container such as Apache Tomcat, or run as a Docker container.

This article explains how to install Jenkins on Ubuntu 20.04 as a standalone service.

Install Java

Jenkins is a Java application that requires Java 8 or later to be installed. We will install OpenJDK 11, an open source implementation of the Java platform.

Run the following commands as root or a user with sudo or root privileges to install OpenJDK 11:

sudo apt update
sudo apt install openjdk-11-jdk

After the installation is complete, check this by checking the Java version:

java -version

The output should look something like this:

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Jenkins installation

Installing Jenkins on Ubuntu is relatively easy. We will enable the Jenkins APT repository, import the repository GPG key, and install the Jenkins package.

Import Jenkins repository GPG keys using the following wget command:

wget -q -O - | sudo apt-key add -

Then add Jenkins repository to the system with:

sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'

After enabling Jenkins repository, update apt package list and install the latest Jenkins by entering:

sudo apt updatesudo apt install jenkins

If you get an error:

Error: W: GPG error: binary/ Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 9B7D32F2D50582E6"

Import the key with:

sudo apt-key adv --keyserver --recv-keys 9B7D32F2D50582E6

The Jenkins service will automatically start after the installation process is complete. You can check this by printing the service status:

systemctl status jenkins

You should see something like this:

● jenkins.service - LSB: Start Jenkins at boot time
     Loaded: loaded (/etc/init.d/jenkins; generated)
     Active: active (exited) since Thu 2020-07-16 20:22:12 UTC; 15min ago

Configuring the firewall

If you are installing Jenkins on a remote Ubuntu server behind a firewall, you need to open port 8080.

Typically, you want to only allow access to the Jenkins server from a specific IP or range of IP addresses. For example, to allow connections only from the subnet “”, you would run the following command:

sudo ufw allow proto tcp from to any port 8080

If you need to allow access from anywhere, run:

sudo ufw allow 8080

Jenkins setup

To set up a fresh Jenkins installation, open a browser, enter your domain or IP address followed by port 8080, http: // your_ip_or_domain: 8080.

A page similar to the following appears, prompting you to enter the administrator password that was created during installation.

Use cat to display the password on the terminal:

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

You should see a 32-character alphanumeric password as shown below:


Copy the password from the terminal, paste it into the “Administrator password” field and click “Continue”.

On the next screen, the installation wizard will ask you if you want to install the suggested plugins or if you want to select specific plugins.

Click on the “Install suggested plugins” box and the installation process will begin immediately.

After installing the plugins, you will be prompted to configure the first admin user. Fill in all the required information and click “Save and Continue”.

The next page will ask you to set the URL for your Jenkins instance. The field will be filled in with an automatically generated URL.

Confirm the URL by clicking on the Save and Finish button and the installation process will be complete.

Click on the Start using Jenkins button and you will be redirected to the Jenkins dashboard where you are registered as the administrator you created in one of the previous steps.

At this point, you have successfully installed Jenkins on your server.


In this article, we have shown how to install and perform the initial Jenkins setup on Ubuntu systems.

You can now visit the official Jenkins documentation page and start exploring the Jenkins plugin workflow and model.

If you have any questions, please leave a comment below.