How to install Jenkins on Ubuntu 20.04

s2 0

is an open source automation server that makes it easy to set up Continuous Integration and Continuous Delivery (CI / CD) pipelines.

Continuous Integration (CI) is a DevOps practice where team members regularly post their code changes to the version control repository, after which automated builds and tests are performed. Continuous Delivery (CD) is a set of practices in which code changes are automatically created, tested, and delivered to production.

Jenkins can be installed as a stand-alone application, as a servlet in a Java servlet container such as Apache Tomcat, or as a Docker container.

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

Install Java

Jenkins is a Java application and requires Java 8 or higher to be installed on the system. We 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

After the installation is complete, check 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)

Install Jenkins

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

Import the Jenkins repository GPG keys as follows: wget

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 List of packages and install the latest version of Jenkins by typing:

sudo apt updatesudo apt install jenkins

If you get an error message that says:

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 start automatically after the installation process is complete. You can check this by printing out 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

Adjust firewall

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

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

sudo ufw allow proto tcp from to any port 8080

If you need to allow access from anywhere, do the following:

sudo ufw allow 8080

Set up Jenkins

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

You will see a page similar to the following asking for 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 on “Next”.

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

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

Once the plugins are installed, you will be asked to set up 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 is filled in with an automatically generated URL.

Confirm the URL by clicking the Save and Finish Button and the setup process will be completed.

click on the Start using Jenkins Button and you will be taken to the Jenkins dashboard logged in as the admin user you created in one of the previous steps.

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


In this tutorial, we showed 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 the Jenkins workflow and plug-in model.

If you have any questions please leave a comment below.