(Last Updated On: June 11, 2018)

Hello good people. In this article, we’ll have a look at how to install Jenkins on Ubuntu 18.04 with codename Bionic Beaver. We’ll install the latest version of Jenkins on Ubuntu Bionic Beaver.

Jenkins is an open source automation server written in Java that was designed to automate repetitive tasks that are often encountered in continuous integration and delivery of software.

Installation of Jenkins on Ubuntu 18.04  Bionic Beaver can be done from Ubuntu packages or by downloading and running its Web application ARchive (WAR) file. The most preferred method of installing Jenkins on Ubuntu 18.04 is from apt repository.

Install Jenkins on Ubuntu 18.04 – Prerequisites:

  • Minimum of 1gb ram
  • Update Ubuntu 18.04 server
  • A user with sudo privileges

Install Jenkins on Ubuntu 18.04 ( Bionic Beaver ) – Steps

Let’s start the installation of by doing a system update and upgrade:

# apt-get update
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [83.2 kB]
Hit:2 http://mirrors.digitalocean.com/ubuntu bionic InRelease 
Get:3 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease [83.2 kB]
Get:4 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://mirrors.digitalocean.com/ubuntu bionic-updates/main amd64 Packages [119 kB]
Get:6 http://mirrors.digitalocean.com/ubuntu bionic-updates/universe amd64 Packages [79.8 kB]
Fetched 440 kB in 2s (224 kB/s)
Reading package lists... Done

# apt-get upgrade

You may need to reboot your system before you can proceed since system upgrade may update the kernel.

Add Jenkins repository to Ubuntu 18;04

The version of Jenkins available on Ubuntu 18.04 is older than the upstream version, we’ll use the project-maintained packages to install Jenkins. Add repository key using the command:

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

Once the key has been added, We need to add Jenkins stable Debian package repository

# echo "deb https://pkg.jenkins.io/debian-stable binary/" > /etc/apt/sources.list.d/jenkins.list

Then update apt packages index:

# apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://mirrors.digitalocean.com/ubuntu bionic InRelease 
Hit:3 http://mirrors.digitalocean.com/ubuntu bionic-updates InRelease 
Hit:4 http://mirrors.digitalocean.com/ubuntu bionic-backports InRelease 
Ign:5 https://pkg.jenkins.io/debian-stable binary/ InRelease 
Get:6 https://pkg.jenkins.io/debian-stable binary/ Release [2042 B] 
Get:7 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [181 B]
Get:8 https://pkg.jenkins.io/debian-stable binary/ Packages [12.9 kB]
Fetched 15.1 kB in 1s (17.6 kB/s) 
Reading package lists... Done

Once this is done, install openjdk-8-jdk since Jenkins doesn’t work fine with java 9

$ sudo apt-get install openjdk-8-jdk

If you have more than one version of Java JDK installed, you can select version 8 as default using the command:

$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.

Then install Jenkins

$ sudo apt-get install jenkins

Configure Firewall

If you happen to be using ufw firewall for Ubuntu, open port 8080 on the firewall

[email protected]:~# ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
[email protected]:~# ufw allow 8080
Rule added
Rule added (v6)
[email protected]:~# ufw status
Status: active

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

[email protected]:~# ufw allow ssh
Rule added
Rule added (v6)
[email protected]:~# ufw status
Status: active

To                         Action      From
--                         ------      ----
8080                       ALLOW       Anywhere                  
22/tcp                     ALLOW       Anywhere                  
8080 (v6)                  ALLOW       Anywhere (v6)             
22/tcp (v6)                ALLOW       Anywhere (v6)             

Configuring Jenkins on Ubuntu 18.04

To set up Jenkins installation, visit port  8080 on your server address – domain or IP Address.


The first screen will show the “Unlock Jenkins” message. This indicates the location of the initial password.

Copy Password file:

# cat /var/lib/jenkins/secrets/initialAdminPassword

Enter the password on Administrator Password box and click continue. The next page will ask you to install recommended plugins or plugins that suit your desired Jenkins usage. if not sure, select installation of recommended plugins.

The next page is on setting your login user account:

FInish and log in to Jenkins Dashboard to start administering it.