How To Install Jenkins on Ubuntu


Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform you are working on. It is a free source that can handle any kind of build or continuous integration. You can integrate Jenkins with a number of testing and deployment technologies. This article explains about- “How to install Jenkins on Ubuntu”

To add Jenkins PPA on Ubuntu, use the following command –

$ wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -
$ sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

Now update the packages, use the following command –

$ sudo apt-get update

To install Jenkins, use the following command –

$ sudo apt-get install jenkins

The sample output should be like this –

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   libterm-readkey-perl linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic
   linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
   linux-signed-image-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
   daemon
The following NEW packages will be installed:
   daemon jenkins
0 upgraded, 2 newly installed, 0 to remove and 28 not upgraded.
Need to get 69.9 MB of archives.
After this operation, 70.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 daemon amd64 0.6.4-1 [98.2 kB]
.............................................................................................

To set the port number for Jenkins, using the following command –

$ sudo nano etc/default/jenkins

The sample output should be like this –

# defaults for jenkins continuous integration server

# pulled in from the init script; makes things easier.
NAME=jenkins

# location of java
JAVA=/usr/bin/java

# arguments to pass to java
JAVA_ARGS="-Djava.awt.headless=true" # Allow graphs etc. to work even when an $
#JAVA_ARGS="-Xmx256m"
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true" # make jenkins listen on IPv4 addr$

PIDFILE=/var/run/$NAME/$NAME.pid

# user and group to be invoked as (default to jenkins)
JENKINS_USER=$NAME
JENKINS_GROUP=$NAME
........................................................................

Now search for HTTP_PORT=8080 and replace by HTTP_PORT=8081 as shown below –

# port for HTTP connector (default 8080; disable with -1)
HTTP_PORT=8081

Now save and exit the file.To restart Jenkins, use the following command –

$ sudo service jenkins restart

Copy the following URL and paste on your any favorite browser –

http://localhost:8081/

The sample output should be like this –

Use the following command to find the admin password as shown below –

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

Copy the password and paste on your browser. Now click on continue button. The sample output would be like this –

Now click on Install Suggested Plugins which will promote the following screen as shown below –

After completion of installation process, the following screen comes up for creating the first admin user which is as shown below –

Complete the information which is required and click on the save and finish button. Now it will promote the following screen as shown below –

Now click on start using Jenkins which will promote the following screen as shown below –

In the above article, we have learnt – Learn how To Install Jenkins on Ubuntu. In our next articles, we will come up with more Linux based tricks and tips. Keep reading!

Sharon Christine
Sharon Christine

An investment in knowledge pays the best interest

Updated on: 22-Jan-2020

483 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements