How to install Jenkins on Ubuntu 20.04

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.

本文标题:How to install Jenkins on Ubuntu 20.04

文章作者:Morning Star

发布时间:2022年01月18日 - 12:01

最后更新:2022年01月18日 - 12:01

原始链接:https://www.mls-tech.info/linux/ubuntu-20-setup-jenkins-en/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。