How Can We Help?

How to install Jenkins on Ubuntu 20.04

Table of Content
How to install Jenkins on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04

In this article, we will learn how to install Jenkins on Ubuntu 20.04. Continuous Integration (CI) and Continuous Delivery (CD) are supported by the software platform Jenkins (CD). Software testing, building, delivery, and deployment are all automated using it. Jenkins on Ubuntu produces a potent management tool that advances a development process.

Prerequisites:

  • An Ubuntu server with 20.04 or 22.04 LTS installed server
  • A super user( root) or any user with SUDO privileges.

1: Install Java:

Java Runtime Environment is necessary for Jenkins (JRE). For the Java environment, OpenJDK is used in this manual. The Java Runtime Environment is part of the development kit known as OpenJDK. Java may be installed in many versions on Ubuntu. Make sure Java 8 or Java 11 is specified as the default version if you decide to do this.

1. Verify that Java is already installed on your Ubuntu system.

# java -version
Java binary not found
Java binary not found

Since Java isn't already installed on our PC, we'll use OpenJDK to do it.

Info:

Step 2 may be skipped if Java is already installed on your Ubuntu system.

Image

Open a terminal window first, then execute the following command to update the system package repository:

# apt update

Run one of the following instructions depending on whether Java 8 or 11 is the version you wish to instal:

# apt install openjdk-8-jdk -y

or

# apt install openjdk-11-jdk -y

2: Add the Jenkins Repository and install Jenkins

By importing and applying the GPG keys to the system, Jenkins may be quickly deployed on Ubuntu.

# wget -p -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

After adding GPG keys, use the following command to add the Jenkins package URL to the sources list:

# sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

The system's APT cache only has to be updated once when the Jenkins repository has been enabled.

# apt update

Let's proceed and instal Jenkins in its entirety.

# apt install jenkins -y

Start the Jenkins services

When Jenkins is installed, the service ought to start automatically. Type the command shown below to check the status of the Jenkins service.

# systemctl status jenkins

In my instance, it is active; however, if it is not in your case, start by running the following command:

# systemctl enable --now jenkins

Setup you Jenkins

When you enter your domain name or IP address and port 8080 into your browser's address bar to set up Jenkins, the Unlock Jenkins screen that prompts for a password should appear, as illustrated in the example below.

Homepage of Jenkins
Homepage of Jenkins

Using the cat command on the terminal, you may get the password from the specified place. The following would be the command to get the password:

# cat /var/lib/jenkins/secrets/initialAdminPassword

In this article, we have learnt how to install Jenkins on Ubuntu 20.04 using OpenJDK 8 and OpenJDK 11

Also Read: How to install Tomcat 10 on Ubuntu server, How To Install Java on Fedora server

Table of Contents