How to Install Jenkins on Ubuntu 18.04

April 23, 2020


Jenkins is a software package for software developers. It’s used to automate parts of the testing, build, delivery, and deployment of software.

This guide will help you install Jenkins on an Ubuntu 18.04 system.

How to install Jenkins on Ubuntu.


  • A system running Ubuntu 18.04 Bionic Beaver
  • A user account with sudo privileges
  • Access to a terminal window / command line(Ctrl+alt+T, search > terminal)
  • Java 8

A Brief Note on Jenkins

Jenkins is a software platform that supports continuous integration (CI) and continuous delivery (CD). CI pushes code changes regularly into the official repository. CD implements changes regularly through build, testing, and deployment.

Jenkins requires the Java Runtime Environment (JRE). This guide uses OpenJDK for the Java environment. OpenJDK is a Development Kit, and includes the Java Runtime Environment. At this time, Jenkins only supports Java 8 on Ubuntu (not 10 or 11). You can have multiple different versions of Java installed on your system. If you do, make sure Java 8 is set to the default.

Step 1: Install Java

If you already have Java installed on your system, skip ahead to the next section.

It is recommended that you install OpenJDK from the default repositories. Open a terminal window and enter the following:

sudo apt update
sudo apt install openjdk-8-jdk

You’ll be asked to confirm the download and installation. Press Y and hit Enter, then allow the process to finish.

Step 2: Add the Jenkins Repository

A software repository is a server that holds software packages for download. Jenkins isn’t included in the default Ubuntu repositories, so you’ll need to add it.

1. Start by importing the GPG keys:

wget –q –O - | sudo apt-key add –
Adding Jenkins repository to install Jankins on Ubuntu

Note: GPG stands for Gnu Privacy Guard. This is an encryption key to verify that the software is authentic.

2. Next, open your /etc/apt/sources.list file for editing:

sudo nano /etc/apt/sources.list

3. Scroll to the bottom of the list, and add the following lines:

#  Jenkins software repository
deb binary

4. Write the changes (Ctrl+O), then exit (Ctrl+X).

Add Jenkins on the list of sources file

Step 3: Install Jenkins

1. To install Jenkins on Ubuntu, use the command:

sudo apt update
sudo apt install Jenkins

2. The system prompts you to confirm the download and installation. Press Y and hit Enter, and the system downloads and installs Jenkins.

3. To check Jenkins was installed and is running enter:

sudo systemctl status jenkins

You should see a bright green entry that says active (exited). This means the service is running.

4. Exit the status screen by pressing Ctrl+Z.

Step 4: Modify Firewall to Allow Jenkins

You need to open Port 8080 to allow Jenkins to communicate.

If you’re using the default UFW firewall, enter the following:

sudo ufw allow 8080
sudo ufw status
Open port 8080 to allow Jenkins

If you’re using a different firewall application, follow its specific instructions to allow traffic on Port 8080.

In the default UFW, if you haven’t configured the firewall it displays as inactive. You can enable UFW using the following:

sudo ufw enable

Step 5: Set up Jenkins

1. To launch and set up Jenkins, open a web browser, and navigate to the IP address of your server:


Use the actual IP address or domain name for the server you’re using Jenkins on.

2. You should see a page that prompts you to Unlock Jenkins. You’ll need the default password. You can get the default password by switching to a command line and entering the following:

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

3. The system returns an alphanumeric code. Enter that code, then click Continue.

4. Next, you are prompted to either Install suggested plugins or Select plugins to install. It’s fine to simply install the suggested plugins. You can always install more plugins later. The system continues the initial Jenkins setup.

5. Then you will be prompted to Create First Admin User. Enter the credentials you want to use for your Jenkins administrator, then Save and Continue.

6. After this, you should set up the Instance Configuration. This is the preferred network address for this Jenkins installation. Confirm the address you want to use for your server. This is most likely the same address you used to get to this configuration page. When you’re satisfied, click Save and Finish.

7. You should see a page that says Jenkins is ready! You can click Start using Jenkins to open the Jenkins dashboard.


You should now have a working installation of Jenkins on your Ubuntu system.Next, discover how to setup jenkins on a Kubernetes cluster.

If you are using a different distribution of Linux, we also have a guide on how to install Jenkins od Debian 10, and how to install Jenkins on CentOS.

Was this article helpful?
Sofija Simic
Sofija Simic is an aspiring Technical Writer at phoenixNAP. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.
Next you should read
How to Install Apache Maven on CentOS 7
March 20, 2019

Apache Maven is a project management tool for developing Java applications designed to provide...
Read more
How to Install Apache Tomcat 9 on Ubuntu 18.04
July 2, 2019

Apache Tomcat is a free, open-source, lightweight application server used for Java-based web...
Read more
How to Install Jenkins on Kubernetes Cluster
March 3, 2020

Use a provided set of YAML files to deploy scalable Jenkins on Kubernetes in 4 easy steps.
Read more
How to Install Jenkins on Debian 10 (Buster)
June 15, 2020

If you are a software developer working on a Debian 10 Buster you may want to install Jenkins.
Read more
  • © 2021 Copyright phoenixNAP | Global IT Services. All Rights Reserved.