How To Setup Jenkins On Ubuntu 20.04LTS

  • March 7, 2021

Setup Jenkins On Ubuntu 20.04LTS

Jenkins is an open-source continues integration and continues deployment tool. Which can use to automate application building, testing and deploying. Jenkins is the most popular automation server. Jenkins built using java, which can integrate with numerous plugins.

Prerequisites

OS Requirement: Make sure to use Ubuntu LTS versions

Hardware Requirement:

Minimum Hardware RequirementRecommended Hardware Requirement
1GB+ Hard Disk Space50GB+ Hard Disk Space
256 MB RAM1GB + RAM

Software Requirement:

  • Java - JRE8/11 (32Bit or 64Bit Supported)

Note: Older versions and Java 9, 10,12 are not supported

JDKJRE
OpenJDK 8 , OpenJRE 8JRE 8
OpenJDK 11 , OpenJRE 11JRE 11

STEP 01: Update OS

sudo apt update -y

STEP 02: Install Java

Jenkins is built with Java, So we need to install the appropriate Java version. This time I’m going to use OpenJDK version 11. Now head-over to your ubuntu terminal and do the following steps.

Run this command and pick one OpenJDK version 8 or 11 from the list

sudo apt search openjdk
sudo apt-get install openjdk-11-jdk -y
dimuthu@build-svr:~$ java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

STEP 03: Add GPG Key and Repository

Install GPG Trusted Key

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

Add Jenkins Repository

This step is to append the Jenkins repository in the Debian source.list

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

Once again, update OS repositories.

sudo apt-get update -y

Install Jenkins

sudo apt-get install jenkins -y

STEP 04: Enable & Start Jenkins

Start & enable Jenkins service on system boot.

sudo systemctl enable jenkins
sudo systemctl start jenkins

Optionally, Sometimes you need to allow TCP port 8080 though out the firewall. If you are using Ubuntu, execute the following command.

sudo ufw allow 8080

STEP 05: Access Jenkins

Now, You can access your Jenkins server through the web browser.

http://<YOUR-HOST-NAME-OR-IP>:8080/

For the 1st time, Jenkins will prompt to enter an unlock password. You need to execute the following command on your terminal and copy the output password and paste it into the Administrator password text box.

Troubleshooting: If the "initialAdminPassword" not available, You may have to remove jenkins and try again.

REF: Admin Password Not Available

For the first time, Jenkins will prompt us to unlock, and it will tell us to copy the password from this location. Copy this 32charactor alphanumeric password and paste it into the text box in the wizard.

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

204bedca295343e483335ae2f26e75f4

STEP 07: Install Plugin

In this section, You will need to install Jenkins plugins according to how going to use them. You can choose either option.

In this case, I’m choosing the “select plugins to install option.”

Once you choose the required plugins, click next. This plugin installation may take considerable time. Please wait until completed.

STEP 08: Create First Admin User

Next, You have to provide your “name”, username", “password”, and “email” for the Jenkins admin user.

Next, You need to provide your FQDN or IP address. By default, the IP address will automatically load into the “instance URL” section.

Now, Jenkins installation has been completed successfully. This is the 1st session of the Jenkins tutorial series. If you love to learn more about Jenkins, refer to my other articles available on this website.

If you are facing issues with the installation, please comment below. I will regularly reply here.

Deploy Production Grade Kubernetes Cluster on Azure AKS

  • July 25, 2021

Introduction This tutorial is intended to demonstrate how to setup your 1st Kubernetes cluster on Azure Kubernetes Services (AKS). This tutorial will cover up all the steps that you need to setup complete AKS cluster.

Getting Started With Docker - Quick Start Guide

  • July 14, 2021

Getting Started With Docker - Quick Start Guide Docker Engine Platform as a Service (PaaS) Cloud platform service. Allows you to manage its application and data.

How To Run Microsoft SQL Server On Kubernetes - Azure Kubernetes Service

  • April 17, 2021

Prerequisites: Azure CLI https://docs.microsoft.com/en-us/cli/azure/install-azure-cli 1. Run the Azure CLI with the az command. 1.1 Run the login command. az login Login in the browser with the azure account.