Tutorials

Install Jenkins v2 on Ubuntu 16.04

Introduction

Jenkins is the most widely used open source continuous integration and automation server. It provides a vast variety of community plug-ins to support building, deploying and automating any project, big or small. In its latest version, which we are going install on Ubuntu 16.04, Jenkins becomes more mature and user-friendly.

Installation

Check if Java is installed

A simple way to verify that Java is not present is to write java in the terminal and hit the enter key.

You should see output similar to the following:

The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install <selected package>

Clearly we can understand that Java is not installed and we should install it by selecting a proposed package.

Install Java

Before installing Java, we need to update the apt cache:

sudo apt-get update

Install Java:

sudo apt-get install openjdk-8-jre-headless -y

Now verify that it installed:

java -version

You should see output like the following:

openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

Install Jenkins

Before installing Jenkins, add the key and then the sources list to apt.

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'

Update again apt's cache with the new changes.

sudo apt-get update

Install Jenkins:

sudo apt-get install jenkins -y

Check that Jenkins is up and running:

sudo jenkins service status

Initial Configuration

Unlock Jenkins

By default, Jenkins runs on port 8080. My public IP address for this example is 35.162.36.83. Make a note of your pubic IP address as we'll need it shortly.

Right after we install Jenkins, we can open a browser and go to http://your_ip_address:8080 to see the following:

The unlock page

Due to the fact that there were too many insecure Jenkins installations deployed with the previous versions, Jenkins 2 is locked by default.

In order to unlock it as the administrator write in the terminal:

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

You will get a randomly generated initial password like this one:

7620hf6499ad24a7b88a7a38f8b30c8c2

Copy the password and then paste it in the provided input field.

Press Continue.

Install Plugins

The problem with the previous Jenkins versions was that getting started with it was rather intimidating due to the fact that there were no "batteries included".

There are far too many plugins in the Jenkins ecosystem and a new user had to search through long lists of them with strange names until she could find the one that would match her needs.

Fortunately, the community took notice of this situation and Jenkins 2 can be set up from the beginning with the plugins that the Jenkins community recommends.

Alternatively, if you do not want the Jenkins installation to be bloated with things that you won't need, you can select the specific ones you would like to install.

Install plugins page

Plugins installation progress page

Create the Admin user

When the installation is completed, you should create the admin user. Enter the required details and hit "Save and Finish".

Set up admin details page

Configuration complete

Jenkins is ready and you can start working with it. Good job!

Configuration is complete

Summary

We now have a functional installation of Jenkins 2. Stay tuned for additional tutorials on working with Jenkins 2.

 
  • Great Post. You have a bug on command: sudo jenkins service status. It should be sudo service jenkins status.

  • I was using UBUNTU for past few days just to learn something more about essaymama, but I was not able to do so. I think that the problem was with the way it was treated. We need to fix it asap.

  • I hope you continue to have such quality articles to share with everyone! I believe a lot of people will be surprised to read this article! Visit my website slope game

  • No matter How strong you are alone You are better as part of a group way to first rate skills the ProHomeworkHelp man of steel can do some thing he places his mind to whilst wished.

Log In, Add a Comment