How To install Jenkins on Ubuntu 20.04 LTS

Introduction

Jenkins, an open source automation server, you can efficiently manage tasks, from creation to software deployment. Jenkins is based on Java, installed from Ubuntu packages or by downloading and running its WAR (Web Application Archive) file — a collection of files that make up a complete Web application to run on a server. We will cover everything within the Ubuntu distribution.

Prerequisites

To follow this tutorial, you will need:

Install Ubuntu Server — https://ubuntu.com/download/server

Java OpenJDK 8 or better

Step 1 — Installing Jenkins

First, add the repository key to the system:

sudo apt update

sudo apt install jenkins

Step 2 — Starting Jenkins

Let’s start Jenkins by using systemctl:

sudo systemctl start jenkins

Enable Jenkins to boot

sudo systemctl enable jenkins

Since systemctl doens´t display status output, use the status command to verify that Jenkins started sucessufully:

output Jenkins

Now that Jenkins is up and running, let’s adjust our firewall rules so that we can reach it from a web browser to complete the initial setup.

Step 3 — Opening the Firewall

if you use a cloud structure you have to release it through a firewall, in my case because I’m simulating a virtual machine. But go ahead if you need to.

sudo ufw allow 8080

Step 4 — Setting Up Jenkins

To set your installation, visit Jenkins on its default port 8080, using your server ou IP address: http://localhost:8080

You should receive the Unlock Jenkins screen, which displays the location of the initial password:

in the terminal window, use cat command to display password

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

Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.

The next screen presents the option of installing suggested plugins or selecting specific plugins:

We’ll click the Install suggested plugins option, which will immediately begin the installation process.
When the installation is complete, you’ll be prompted to set up the first administrative user. It’s possible to skip this step and continue as admin using the initial password we used above, but we’ll take a moment to create the user.
After confirming the appropriate information, click Save and Finish. You’ll receive a confirmation page confirming that “Jenkins is Ready!”:
At this point, you have completed a successful installation of Jenkins.

Video : https://www.youtube.com/watch?v=Z5jXamNYumM&t=39s

Disclaimer:

You will need to explicitly install a Java runtime environment, because Oracle’s Java RPMs are incorrect and fail to register as providing a java dependency. Thus, adding an explicit dependency requirement on Java would force installation of the OpenJDK JVM.

  • 2.164 (2019–02) and newer: Java 8 or Java 11
  • 2.54 (2017–04) and newer: Java 8
  • 1.612 (2015–05) and newer: Java 7

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store