Linux Tutorials, Guides & Latest Tech Stuffs

How to install Jenkins on Ubuntu 18.04

Jenkins is a  popular solution for automated building, testing and deploying software. It is a very extensible product whose functionality can be extended using plugins. Jenkins requires JAVA 8 as a dependency. This post demonstrates how to install Jenkins on Ubuntu 18.04


  • One Ubuntu 18.04 server with non-root (sudo) user
  • Install JAVA 8 – Java Runtime Environment ( JRE ) or a Java Developement Kit (JDK), any one is fine
  • Ubuntu instance should have at least 1 GB of memory and 50 GB+ drive space
  • See Jenkins Official site for Jenkins Master Hardware recommendations

Update Ubuntu

We’ll update Ubuntu machine before running any command for the first time

sudo apt-get update

Installing JAVA 8

As already described JAVA 8 is  required dependency for Jenkins. We’ll be installing Open JDK Java 8 on Ubuntu machine before installing Jenkins.

sudo apt-get install openjdk-8-jre

Installing Jenkins

Jenkins easily get installed on Ubuntu, first you need to add Jenkins repository key to system

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

When key will be added successfully, you will see OK message on terminal. Next we will append Jenkins Debian package repository address to the server’s source list.

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

When key and repository are added, we will update Ubuntu package management apt-get to start using this new repository.

sudo apt-get update

After successful update we’ll install Jenkins and its dependencies

sudo apt-get install jenkins

Finally, We have Jenkins Installed on Ubuntu 18.04 server. Now we’ll start Jenkins Server

Starting Jenkins

For starting Jenkins we’ll use systemctl command with sudo

sudo systemctl start jenkins

We can check Jenkins running status using systemctl status command

sudo systemctl status jenkins

If everything went well, status output ( shown below ) will show active status of Jenkins.

Setting Up Jenkins

Jenkins by default runs on port 8080. You can access jenkins on your server domain name or IP address: http://ip_address_or_domain_name:8080. 

We should have “Unlock Jenkins” Screen which displays the location of the Jenkins password that created automatically while booting.

use cat command to print Jenkins initialAdminPassword on terminal:

cat /var/lib/jenkins/secrets/initialAdminPassword

if you are getting permission denied , you can use sudo before command:

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

We’ll copy this alphanumeric password and paste it to the “Administrator Password” input field and click on continue button.

Next we’ll have “Customize Jenkins” Screen, Click on Install suggested plugins to install most useful plugins.


Plugins installation will be started, “Getting Started” screen will also show you install progress and plugins being installed.


After completion of installation on next screen we’ll set first admin user. This step can be skipped by continuing as admin ( option shown left to Save and Finish button ) but we will create a admin user named “nixgyd”. Once first user is created you should see “Jenkins is ready!” screen and Jenkins setup is completed.


Click on “Start using Jenkins” button to reach Jenkins dashboard.


Now Jenkins is successfully installed and ready to use.

Change default port

If your any other application is running on port 8080 and you want to change default port. You can edit Jenkins default configuration located at line number 63 in /etc/default/jenkins.

sudo vim /etc/default/jenkins


Restarting Jenkins

If you have changed default HTTP_PORT of Jenkins, you should restart Jenkins to load new configurations.

sudo service jenkins restart


In this tutorial we’ve learned to installed Jenkins on Ubuntu 18.04 server and created an administrative user. It is suggested to run Jenkins over a reverse proxy server and SSL to protect sensitive information like passwords.

Pranav K

Pranav K is a software engineer and all-round computer geek. His interests include AWS, Ubuntu and Wordpress

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.