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:
- wget -q -O — https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
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:
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:
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:
admin
using the initial password we used above, but we’ll take a moment to create the user.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