1饲常、安裝java環(huán)境
sudo apt-get isntall openjdk-11-jdk
驗(yàn)證
qiang@09230:~$ java -version
openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.20.04.1, mixed mode, sharing)
drc@iZwz91oq31508figapkas0Z:~$
2、安裝Jenkins
2.1Jenkins 的 Debian 軟件包存儲(chǔ)庫狼讨,用于自動(dòng)安裝和升級(jí)贝淤。要使用此存儲(chǔ)庫,首先將密鑰添加到您的系統(tǒng)
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
2.2政供、添加一個(gè) Jenkins apt 存儲(chǔ)庫條目
在/etc/apt/sources.list中添加deb https://pkg.jenkins.io/debian-stable binary/
sudo vim /etc/apt/sources.list
2.3播聪、更新你的本地包索引
sudo apt-get update
如果發(fā)現(xiàn)如下錯(cuò)誤,通過安裝一個(gè)包解決
sudo apt install ca-certificates
Hit:73 http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu focal InRelease
Ign:72 https://pkg.jenkins.io/debian-stable binary/ InRelease
Err:74 https://pkg.jenkins.io/debian-stable binary/ Release
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 151.101.110.133 443]
Reading package lists... Done
E: The repository 'http://pkg.jenkins.io/debian-stable binary/ Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
drc@iZwz91oq31508figapkas0Z:~$
再來一次sudo apt-get update
qiang@09230:~$ sudo apt-get update
Hit:1 http://mirrors.cloud.aliyuncs.com/ubuntu focal InRelease
Hit:2 http://mirrors.cloud.aliyuncs.com/ubuntu focal-updates InRelease
Hit:3 http://mirrors.cloud.aliyuncs.com/ubuntu focal-backports InRelease
Hit:4 http://mirrors.cloud.aliyuncs.com/ubuntu focal-security InRelease
Hit:6 http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu focal InRelease
Ign:5 https://pkg.jenkins.io/debian-stable binary/ InRelease
Get:7 https://pkg.jenkins.io/debian-stable binary/ Release [2,044 B]
Get:8 https://pkg.jenkins.io/debian-stable binary/ Release.gpg [833 B]
Get:9 https://pkg.jenkins.io/debian-stable binary/ Packages [21.9 kB]
Fetched 24.8 kB in 2s (11.9 kB/s)
Reading package lists... Done
qiang@09230:~$
2.4布隔、安裝jenkins
sudo apt-get install jenkins
如下則安裝成功
qiang@09230:~$ sudo apt-get install jenkins
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
jenkins
0 upgraded, 1 newly installed, 0 to remove and 220 not upgraded.
Need to get 91.4 MB of archives.
After this operation, 95.0 MB of additional disk space will be used.
Err:1 https://pkg.jenkins.io/debian-stable binary/ jenkins 2.332.3
Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 151.101.74.133 443]
E: Failed to fetch https://pkg.jenkins.io/debian-stable/binary/jenkins_2.332.3_all.deb Could not wait for server fd - select (11: Resource temporarily unavailable) [IP: 151.101.74.133 443]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
qiang@09230:~$
3离陶、啟動(dòng)Jenkins
啟動(dòng)
sudo service jenkins start
或
sudo systemctl start jenkins
查看jenkins運(yùn)行狀態(tài)
如下顯示active處于活躍狀態(tài)
qiang@09230:~$ systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-05-18 17:53:44 CST; 1h 51min ago
Main PID: 369083 (java)
Tasks: 46 (limit: 9105)
Memory: 2.3G
CGroup: /system.slice/jenkins.service
└─369083 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/java/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
qiang@09230:~$
設(shè)置jenkins跟隨系統(tǒng)開機(jī)自啟動(dòng)
sudo systemctl enable jenkins
4、訪問Jenkins
此時(shí)輸入網(wǎng)址在服務(wù)器的8080端口下可以訪問Jenkins
按如下圖指引建立Jenkins賬號(hào)并登錄:
把jinkins配置在80808端口以免占用8080端口
以上衅檀,安裝Jenkins成功枕磁!