How to Install Jenkins on Ubuntu 20.04

Published on

4 min read

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 in which team members regularly commit their code changes to the version control repository, after which automated builds and tests are run. Continuous delivery (CD) is a series of practices where code changes are automatically built, 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 can be run as a Docker container.

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

Installing Java

Jenkins is a Java application and requires Java 8 or later to be installed on the system. We’ll install OpenJDK 11 , the open-source implementation of the Java Platform.

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

sudo apt updatesudo apt install openjdk-11-jdk

Once the installation is complete, verify it 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)

Installing Jenkins

Installing Jenkins on Ubuntu is relatively straightforward. We’ll enable the Jenkins APT repository, import the repository GPG key, and install the Jenkins package.

Import the GPG keys of the Jenkins repository using the following wget command:

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

Next, add the Jenkins repository to the system with:

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

Once the Jenkins repository is enabled, update the apt package list and install the latest version of Jenkins by typing:

sudo apt updatesudo apt install jenkins

If you get an error message saying:

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

Jenkins service will automatically start after the installation process is complete. You can verify it 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

Adjusting Firewall

If you are installing Jenkins on a remote Ubuntu server that is protected by a firewall , you’ll need to open port 8080.

Typically, you would want to allow access to the Jenkins server only from a specific IP address or IP range. 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

Setting Up Jenkins

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

A page similar to the following will be displayed, prompting you to enter the Administrator password that is created during the installation:

unlock jenkins

Use cat to display the password on the terminal:

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

You should see a 32-character long 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 setup wizard will ask you whether you want to install suggested plugins or you want to select specific plugins.

customize jenkins

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

jenkins getting started

Once the plugins are installed, you will be prompted to set up the first admin user. Fill out all required information and click “Save and Continue”.

jenkins create admin user

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

jenkins instance configuration

Confirm the URL by clicking on the Save and Finish button, and the setup process will be completed.

jenkins is ready

Click on the Start using Jenkins button, and you will be redirected to the Jenkins dashboard logged in as the admin user you have created in one of the previous steps.


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


In this tutorial, we have shown you how to install and complete the initial configuration of Jenkins on Ubuntu systems.

You can now visit the official Jenkins documentation page and start exploring Jenkins’s workflow and plug-in model.

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