1. Home
  2. Tutorials
  3. Installing Jenkins for Ubuntu 16.04

Installing Jenkins for Ubuntu 16.04

Installing Jenkins for Ubuntu 16.04
Installing Jenkins for Ubuntu 16.04

About Jenkins

Jenkins is an open source automation server meant to automate repeating technical tasks part of the continuous integration and delivery of software. Jenkins is Java-based and could be installed from Ubuntu packages or by download and using its Web application Archive (WAR) file, a group of files which create an entire web application meant for running on a server.

In the following tutorial we’ll be demonstrating how you can install Jenkins by adding its Debian package repository, and afterwards use that repository to install the package with apt-get.


For this guide you’ll need the following:

An Ubuntu 16.04 server configured with a non-root sudo user and a firewall, we suggest beginning with at least 1 GB of Ram.

After the server is set up, you’re prepared to follow along.

Installing Jenkins

Generally, the version of Jenkins in the default Ubuntu package is before the latest one, to be able to take advantage of the latest fixes and features, we’ll use the project-maintained packages to install Jenkins.

To begin, we’ll append the repository key to the system.

wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -

Once you’ve got the key added, the system is going to return an OK. Then, we’ll add the Debian package repository address to the server’s sources.list:

echo deb https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list

After both of those are in place, we’ll execute the update so that apt-get uses the latest repository available:

sudo apt-get update

Lastly, we’ll install Jenkins along with the dependencies, and Java aswell:

sudo apt-get install jenkins

Since we’ve got Jenkins and its dependencies in place, we can now run the Jenkins server.

Starting Jenkins

With the following command, we can run Jenkins:

sudo systemctl start jenkins

Because systemctl won’t have a display output, we are going to use the status command to confirm it has started properly:

sudo systemctl status Jenkins

In case everything is well, the start of the output will show that the service is up 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)

Since we’ve got Jenkins running, we’ll just need to adjust our firewall rules so we may reach Jenkins from a web browser to finish the initial set up.

Opening the Firewall

Automatically, Jenkins will be using port 8080, so we’ll want to open that port with ufw:

sudo ufw allow 8080

Now we’ll be able to see the new rules by checking UFW’s status.

sudo ufw status

We’ll want to see that the 8080 port allows traffic from anywhere:


Status: active

To                         Action      From

--                         ------      ----

OpenSSH                    ALLOW       Anywhere

8080                       ALLOW       Anywhere

OpenSSH (v6)               ALLOW       Anywhere (v6)

8080 (v6)                  ALLOW       Anywhere (v6)

Setting up Jenkins

To set up our installation, we’ll go to Jenkins located on its default port, 8080, we can do this with the server’s domain name or IP address:


Now we will see “Unlock Jenkins” screen, and it should present the location of the initial password.

Once we’re in the terminal window, we’ll use the cat command to present the command:

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

First, select the 32-character alphanumeric password in the terminal and copy it into your clipboard, then paste it into the “Administrator Password” field, then press “Continue”. Once you’ve reached the next screen, it will display the option to install suggested plugins or specific ones that you’d like.

Now, we’ll use the “install suggested plugins” option, this should instantly start the installation procedure.

Next, nce the installation is done, we’ll be asked to setup the first administrative user, feel free to skip this step and proceed as admin with the initial password we used in the last step, however we’ll take a second to create the user.

Finally, after the first admin user is in place, you’ll see a “Jenkins is ready” Confirmation screen.

then, press “Start using Jenkins” to go to the main Jenkins dashboard.

At this point, Jenkins should’ve been successfully installed.


To conclude this tutorial, we’ve installed Jenkins with the project-given packages, started the server opened the firewall, and made an administrative user. Now, you may start exploring Jenkins.

Updated on January 4, 2018

Was this article helpful?

Related Articles

Add A Comment