This article demonstrates how to install the Jenkins server in Ubuntu 20.04.

Install JDK

First, the JDK needs to be installed, in this article, we choose to install openjdk 11.

1
sudo apt-get install openjdk-11-jdk

After the installation is completed, we can execute the following command to confirm that the installation was successful.

1
java -version

If successful, the system displays the following information:

1
2
3
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

Install Jenkins

We will use the Jenkins APT repository, import the source GPGkey, and install the Jenkins package.

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

To add a software source to the system:

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

Upgrade the apt package list

1
sudo apt update

Install jenkins

1
sudo apt install jenkins

After the installation is completed, we can use the ‘systemctl status’ to check the status of service running

1
sudo systemctl status jenkins

The system displays information similar to the following

1
2
3
4
5
6
7
● jenkins.service - LSB: Start Jenkins at boot time
Loaded: loaded (/etc/init.d/jenkins; generated)
Active: active (exited) since Sun 2022-01-16 11:08:29 CST; 33s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 2269)
Memory: 0B
CGroup: /system.slice/jenkins.service

The above steps complete the installation of jenkins. How to configue the jenkins can refer to other articles.

The initial password is stored in /var/lib/jenkins/secrets/initialAdminPassword.

Log file is /var/log/jenkins/jenkins.log.