Installing Jenkins on Ubuntu




Jenkins is created in Java and so requires JRE to be installed on the system to run. At the time of writing this, Jenkins supports Java 8. So check if Java is installed or not and install Java if it is not already installed on the system. You can follow these steps if you are not sure  about installing java on your Ubuntu machine.


Jenkins Installation


Run the below command to  download the package key from Jenkins repository and install it on the machine.


wget -q -O - | sudo apt-key add -
It should download and install Jenkins package key, but some times you may see failures similar to the below.




In case of these failures, run the same command in 2 different steps. Run the below 2 commands to download and install the jenkins key.

sudo wget –v –o


sudo apt-key add






The distributions for Debian and Ubutunu are same, so don’t get confused with Debian term in the urls.

Once the jenkins key is successfully added to the machine, we will add jenkins distribution url to the ubuntu repository source list.

The sources list is configured in the /etc/apt/ folder, so navigate to that folder using the below command.


cd /etc/apt/




Run the below command to open the sources.list file and edit it.

sudo nano sources.list



Add the below line to the file and then save the file.

deb binary/




Since we added a new repository to the sources list, let us run an update to apply the changes we made.


sudo apt-get update




Once the package list is updated, let us start installing jenkins.


sudo apt-get install jenkins


As indicated in the above screen shot, it may fail due to missing dependency ‘Depends’.


The ‘Depends’ is available in universe repository, so install it before trying to reinstall Jenkins again.


sudo add-apt-repository universe




Once universe is installed successfully, try reinstalling jenkins again.


sudo apt-get install jenkins




Type ‘y’ when the installer asks whether you want to continue with the installation.





Jenkins is successfully installed on a Ubuntu machine.



The jenkins configuration file is /etc/default/jenkins which contains lot of configurations related to jenkins instance.

Run the below command to review the jenkins configuration file.

cd /etc/default/



sudo nano jenkins



The configuration file contains information on the location of jenkins app, whether it is to run as a stand alone app or it is going to run in a web container, the location of jenkins war and port on which the app runs etc. We will review these configurations later.





The jenkins home directory should look similar to below. The jenkins home directory information is available in the above configuration file.






To know the status of jenkins, run the below command.

sudo service jenkins status



If the jenkins is running without issues, then you can see the status as ‘active’ in the Active field in the above message. It also indicates when it was last started and how long it is running since last restart.



If the jenkins is stopped, then the Active field indicates ‘inactive’ along with the information on when it was shutdown.


You can run the below command to start jenkins.


sudo service jenkins start

Run the below command to stop jenkins.

sudo service jenkins stop

Run the below command to restart jenkins.

sudo service jenkins restart



Initial Jenkins Run


Once jenkins is installed successfully and you confirmed it is running successfully, open the jenkins url in browser to start configuring jenkins and using it.


Browse to <your host ip address>:8080 to open jenkins. Replace <your host ip address> with your ubuntu system ip.


You will see the below page when you access jenkins for the 1st time. It asks for one time Administrator password which is available at the below location on the machine jenkins is installed.




The path of the password file is indicated in the initial Jenkins page displayed when jenkins is accessed for 1st time.




Open the initialAdminPassword file and copy the password and paste it in the ‘Unlock Jenkins’ page and click on ‘Continue’.



The plugins used by Jenkins can be configured in the below page. Select ‘Install suggested plugins’ to stick with the default plugins suggested by Jenkins. You can manage the plugins at any point of time from Jenkins UI, so continue with the suggested plugins.




Jenkins will install the selected plugins.




After the plugins are installed, you can create the first admin user which can be used to manage Jenkins.




Provide username, password, full name, email id and click on ‘Save and Continue’ to create Jenkins admin user.



You can configure the jenkins url from the below screen. This can also be changed at any point of time, so leave it to the suggested value and click on ‘Save and Finish’.



Configuring Jenkins is now complete. Click on ‘Start using Jenkins’ to view the Jenkins home page.




The jenkins home page for the admin user created earlier is displayed.





Stop Jenkins service before uninstalling it. Then run the below command to uninstall jenkins


sudo apt-get remove --purge jenkins

Type ‘y’ when asked for confirmation.






In this post, we learnt how to install, run, configure and uninstall jenkins on Ubuntu. The later processes of creating and running jobs is same irrespective of where the jenkins instance is running.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s