How to Setup Jenkins step by step on ubuntu machine

Are you spending lot of time for deploying code in your infrastructure and with lots of steps and software’s ? Don’t worry you are at right place to learn about famous open source tool Jenkins which not only deploy code quickly with a click of button but also with various other benefits. I am sure most of you might be using it but I am sure this tutorial will guide you through some important concepts and practical’s.

In this tutorial we are going to demonstrate you about what is Jenkins and how can you setup on ubuntu 18.04 step by step.

Table of Content

  1. What is Jenkins
  2. Prerequisites
  3. Install Jenkins on Ubuntu 18.04 LTS
  4. Setup Jenkins
  5. Conclusion

What is Jenkins?

Jenkins is an open source automated CI/CD tool where CI stands for continuous integration and CD stands for Continuous delivery. Jenkins has its own built-in Java servlet container server which is Jetty. Jenkins can also be run in different servlet containers such as Apache tomcat or glassfish.

  • Jenkins is used to perform smooth and quick deployment. It can be deployed to local machine or on premises data center or any cloud.
  • Jenkins takes your code any sort of code such as python, java or go or JS etc. and compiles it using different compiler such as MAVEN one of the most used compiler and then builds your code in war or Zip format and sometimes as a docker Image. Finally once everything is built properly it deploy as an when required . It integrates very well with lots of third party tools.

Let me quickly give you quick demo for below Jenkins architectural diagram.

  • Considering that Jenkins is installed.
  • Install plugins it could be third party such as terraform, bitbucket , python, blueocean etc
  • Jenkins is configured in such a way that it can fetch the code from any of the repository such as GIT , bitbucket , SVN or TFS .
  • Jenkins compiles the code using plugins if required and then later build it.
  • We can include some test cases along with build to test some functionalities of code.
  • Later we deploy code on different environments such as AWS, GCP, Windows machine, Linux machine etc.


  • Ubuntu machine preferably 18.04 version + , if you don’t have any machine you can create a ec2 instance on AWS account
  • It is recommended to have 4GB RAM
  • At least 5GB of drive space
  • Java version 8 or 8+ ( If Java is not installed please follow me to next step else skip it )

You may incur a small charge for creating an EC2 instance on Amazon Managed Web Service.

How to Install Java Version 11 on ubuntu 18.04 machine

sudo apt install default-jdk  # Here we are installing Java Version: Java SE 11 (LTS)
java -version               # To check the Installed Java Version
which java :         # It will locate executable file location which is /usr/bin/java 

whereis java         # It will give the location  of all the files related to Java 

The Installation directory of Java is /usr/lib/jvm/java-1.8.0-openjdk-amd64 and this confirms that Java is successfully installed on our ubuntu 18.04 machine. Now, let us install Jenkins.

Install Jenkins on Ubuntu 18.04 LTS

  • Update your system packages.
sudo apt update
  • Add Jenkins Public key to your system
wget -q -O - | sudo apt-key add -
  • Now, add Jenkins repository to your system
sudo sh -c 'echo deb binary/ > \
  • Again update your system
sudo apt-get update
  • Now install Jenkins package
sudo apt-get install jenkins

Now Jenkins service should be up and running. Let us check the status of Jenkins service now.

Setup Jenkins

  • Jenkins can be opened on web browser with following URL : <Jenkins-installation-server>:8080. As soon as I opened this URL it prompted for Administrator password . It also provide the file details where initial password is stored.
  • Now go to Jenkins server and look for password with below command and paste it under Administrator password.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • After successfully adding your password you will be prompted for Plugins installation. As this is the demo, we will select Install Suggested Plugins option.
  • Now it will prompt for First admin user. Please fill the required information and keep it safe with you , as you will use this to login.
  • Now Jenkins URL configuration screen will appear , keep it as it is for now.
  • Click on Save and Finish.
  • Now your Jenkins is ready , click on Start using Jenkins. Soon, you will see Jenkins Dashboard. You can create New Jobs by clicking on New Item.


You should now have a Jenkins instance running . Your Jenkins should now be ready to begin helping you manage your organization’s deployments.

Hope this tutorial will help you in understanding and setting up Jenkins on ubuntu machine. Please share with your friends.