November 24, 2020
How to install Jenkins on Ubuntu 20.04

How To Install Jenkins On Ubuntu 20.04 LTS

On this article we will discuss about Jenkins installation on Ubuntu 20.04 LTS.

Introduction

Jenkins is an open-source automation server that is used to automate software development. Jenkins will automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery. By using Jenkins the developers will know the status of his application. Failures, new features, and processes will be automated and monitored.

Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed. The creator of Jenkins is Kohsuke Kawaguchi. Released under the MIT License.

Jenkins Installation

Jenkins is free application, so we can download the source and install it on our server free of charge. On this section forward, we will discuss how to install Jenkins.Jenkins installation will be divided into several step.

  • Prerequisite
  • Installing Jenkins
  • Configure Jenkins

Prerequisite

  • Hardware
    Recommended hardware configuration for a small team:
    1 GB+ of RAM
    50 GB+ of drive space
  • Software
    Java: OpenJDK JDK / JRE 8 – 64 bits or OpenJDK JDK / JRE 11 – 64 bits
    Web browser: see the Web Browser Compatibility page

On our environment, we have installed OpenJDK 11. We will verify the java version installed with command line below :

ramans@otodiginet:/$ java --version

Output :

openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)

Installing Jenkins

Adding Jenkins Repo

We will add the Jenkins repository key to the system, with the command line below.

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

How to install Jenkins on Ubuntu

When the key is added succesfully, the system will return OK. Then, we will append the Ubuntu package repository address to the server’s sources.list, by submitting command line below :

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

Adding Jenkins repositories

Install Jenkins

The Jenikins installation process will be begin by submitting command line below.

ramans@otodiginet:/$sudo apt-get update 
ramans@otodiginet:/$sudo apt-get install jenkins

update system

After installation was succeded, then we verify if the Jenkins service has been up.

ramansah@otodiginet:/$ systemctl start jenkinsramansah@otodiginet:/$ systemctl status jenkins

Jenkins systemctl status

Enabling Firewall for Jenkins

To access the Jenkins via browser, we have to enable the Jenkins port to be accessible. For this purpose, we have to enable/adjusting the Firewall on our Ubuntu. For this purpose we will be using the ufw command line to activate and enable the firewall.

ramans@otodiginet:/$ sudo ufw status
Status: inactive
ramans@otodiginet:/$ sudo ufw allow 8080
Rules updated
Rules updated (v6)
ramans@otodiginet:/$ sudo ufw status
Status: inactive
ramans@otodiginet:/$ sudo ufw enable
Firewall is active and enabled on system startup
ramans@otodiginet:/$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
8080                       ALLOW       Anywhere                  
8080 (v6)                  ALLOW       Anywhere (v6)

enabling Firewall

Configuring Jenkins

After Jenkins installation was completed done, then we have to configure the Jenkins for our purpose. We can configure the Jenkins via browser. The service is hosted on http://your_ip_or_domain:8080. On this example, we hosted the Jenkins service on http://otodiginet:8080.

Jenkins configuration web

On the installation process, the Jenkins installer creates an initial 32-character long alphanumeric password. Use the following command to print the password on your terminal.

ramans@otodiginet:/$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Output will be :

6de4a6624d5d4146ac9bf038856fdf03

 

 

So far the Jenkins installation on Ubuntu 20.04 has been successfully done. Then for the next step, just follow the Jenkins tutorial on this link, https://www.jenkins.io/doc/tutorials/.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *