How to install Jenkins on Ubuntu 16.04


Jenkins is an open source automation server designed to automate repetitive technical tasks related to continuous integration and software delivery. Jenkins is Java based and can be installed from Ubuntu packages or by downloading and running its web application file (WAR) – a set of files that make up a complete web application that is meant to run on a server.

In this article, we install Jenkinsby adding it to the Debian package repository, and then using that repository, install the package with apt-get


To accomplish this you will need:

One 16.04 Ubuntu server configured with a non-root user sudo and firewall, this configuration can be viewed in the initial setup of the Ubuntu 16.04 server. We recommend starting with at least 1GB of RAM. See manual choosing the right hardware for the masters when planning the capacity of a Jenkins production installation.

With the server set up, you’re ready to follow.

Step 1 – Installing Jenkins

Jenkins version is included by default in Ubuntu packages not the latest available version from the project itself. In order to take advantage of the latest fixes and features, we will be using project packages that support Jenkins installation.

First, we will add the repository key to the system.

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

When adding a key, the system will return OK… Next, we add the package address to the Debian repository for the server identity sources.list:

echo deb binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list

Next, we will run update so that apt-get will use the new storage:

sudo apt-get update


Finally, we’ll install Jenkins and its dependencies, including Java:

sudo apt-get install jenkins

Now that Jenkins and its dependency are installed, we will start the Jenkins server.

Step 2 – Starting Jenkins

Through systemctl we will start Jenkins:

sudo systemctl start jenkins

Because systemctl does not display output, we will use the command statusto make sure it started successfully:

sudo systemctl status jenkins

If all went well, the start of the output should indicate that the service is active and configured to start at boot:


● jenkins.service - LSB: Start Jenkins at boot time
  Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
  Active:active (exited) since Thu 2017-04-20 16:51:13 UTC; 2min 7s ago
    Docs: man:systemd-sysv-generator(8)

Now that Jenkins is up and running, we will adjust our firewall rules so that we can access Jenkins from a web browser to complete the initial configuration.

Step 3 – Opening the Firewall

Jenkins is running on port 8080 by default, so we will open this port with ufw:

sudo ufw allow 8080

We can see the new rules by checking the status in UFW.

sudo ufw status


We should see that traffic is allowed to port 8080 from anywhere in the world:


Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
8080                       ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
8080 (v6)                  ALLOW       Anywhere (v6)

Now that Jenkins is installed and the firewall allows access to it, we can do the initial configuration.

Step 3 – Configuring Jenkins

In order to customize our installation, we will visit Jenkins using the server’s domain name or IP address: http://ip_address_or_domain_name:8080

We should see the “Unlock Jenkins” screen that displays the location of the original password

In a terminal window, we use the command cat to display the password:

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

We will copy the 32-digit alphanumeric password from the terminal and paste it into the Administrator Password field and then click the Continue button. The next screen presents the option to install suggested plugins or select specific plugins.

Jenkins screen setup

We click on the “Install suggested plugins” option, which will immediately start the installation process:

Getting started Jenkins.  Installing screen plugins

When the installation is complete, you will be prompted to create your first admin user. You can skip this step and continue as admin using the original password we used above, but we’ll take a moment to create a user.

Note: Jenkins server is not encrypted by default, so the data submitted in this form is not secure. When you’re ready to use this installation, follow the instructions in How to Set Up Jenkins with SSL Using an Nginx Reverse Proxy. This will protect the credentials and information that is transmitted through the web interface.

Create first user in Jenkins admin

After the first admin user is ready, you should see the “Jenkins is ready!” Confirmation screen.

Jenkins screen ready
Click the “Start using Jenkins” button to visit the Jenkins main dashboard:

Welcome to Jenkins screen

At this point, Jenkins has been successfully installed.


In this article, we installed Jenkins using project packages, started the server, configured a firewall, and created a user with administrator rights. At this point, you can start exploring Jenkins.

When you have completed your research, if you decide to continue using Jenkins by following the instructions on how to set up Jenkins with SSL using an Nginx reverse proxy to protect passwords, as well as any sensitive system or product information that might be sent between your computer and a server in plain text.