How to Install and Setup Jenkins on Ubuntu.

Jenkins is an open-source Continuous Integration (CI) platform that is free to use. It is written in Java which makes it platform independent i.e it can run on different platforms including Linux, Windows, and macOS. Jenkins is the most well-known Continuous Integration process.

Jenkins builds can be activated in different ways, for instance by commit in the version control method, by scheduling via the cron expressions, and by requesting a proper build URL. It may also be triggered after the different builds in the queue get finished. Jenkins’s functionality will be offered with plugins.

So, here we will be learning how to install and setup Jenkins on an Ubuntu server.


Jenkins is written in Java so we need to install Java and JRE (Java Runtime Environment) so that Jenkins can work on the server.

JRE Installation

First, we will install JRE on server by using apt package.

$ sudo apt update
$ sudo apt install default-jre

Check the JRE version by the following command.

$ java -version

JDK Installation

Next, we need to install JDK (Java Development Kit). JDK is one of the important components of Java that makes Jenkins usable.

$ sudo apt install default-jdk

Check the version of JDK by following commands.

$ javac -version

Now, we have installed Java successfully on the server.

Installing Jenkins

Step 1. Add the repository key

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

Append this package to server list:

$ sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list'

Step 2.  Install Jenkins

Install Jenkins with the Ubuntu’s apt package

 $ sudo apt update
 $ sudo apt install Jenkins 

Step 3. Start Jenkins

$ sudo systemctl start jenkins

Check the status of Jenkins by following command

$ sudo systemctl status jenkins

Step 4. Setup Jenkins

Go to the default port of Jenkins 8080 on your web browser.



Get the password at the given path.

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

Copy the password and paste in the Jenkins setup page.

You will get the customize the Jenkins page which allow you to install the plugins. You can choose any option but the “Installed suggested plugin” is recommended.


After installation, create the user and password for Jenkins and press “Save and Continue”.


After this Jenkins is ready to use.


At this step, Jenkins is setup is complete and now you can create a project by clicking on New Item.

You can follow our Jenkins tutorial and learn how to use Jenkins easily.

Leave a Reply

Your email address will not be published. Required fields are marked *