CentOS 7 安裝Jenkins
阿新 • • 發佈:2018-12-04
- 首先安裝好Java(JAVA_HOME)
[[email protected] ~]# java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
- 獲取jenkins安裝原始檔 wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
[[email protected] ~]# wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo --2018-12-03 14:55:15-- http://pkg.jenkins-ci.org/redhat/jenkins.repo 正在解析主機 pkg.jenkins-ci.org (pkg.jenkins-ci.org)... 52.202.51.185 正在連線 pkg.jenkins-ci.org (pkg.jenkins-ci.org)|52.202.51.185|:80... 已連線。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:71 正在儲存至: “/etc/yum.repos.d/jenkins.repo” 100%[==================================================================================>] 71 --.-K/s 用時 0s 2018-12-03 14:55:16 (6.47 MB/s) - 已儲存 “/etc/yum.repos.d/jenkins.repo” [71/71])
- 匯入公鑰
[[email protected] ~]# rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
- 安裝Jenkins
[[email protected] ~]# yum install -y jenkins 已載入外掛:fastestmirror, langpacks Determining fastest mirrors * base: mirrors.huaweicloud.com * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 jenkins | 2.9 kB 00:00:00 nodesource | 2.5 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/4): nodesource/x86_64/primary_db | 42 kB 00:00:01 (2/4): updates/7/x86_64/primary_db | 6.0 MB 00:00:02 (3/4): extras/7/x86_64/primary_db | 205 kB 00:00:02 (4/4): jenkins/primary_db | 117 kB 00:00:02 正在解決依賴關係 --> 正在檢查事務 ---> 軟體包 jenkins.noarch.0.2.153-1.1 將被 安裝 --> 解決依賴關係完成 依賴關係解決 ============================================================================================================================ Package 架構 版本 源 大小 ============================================================================================================================ 正在安裝: jenkins noarch 2.153-1.1 jenkins 72 M 事務概要 ============================================================================================================================ 安裝 1 軟體包 總下載量:72 M 安裝大小:72 M Downloading packages: jenkins-2.153-1.1.noarch.rpm | 72 MB 00:00:12 Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安裝 : jenkins-2.153-1.1.noarch 1/1 驗證中 : jenkins-2.153-1.1.noarch 1/1 已安裝: jenkins.noarch 0:2.153-1.1 完畢!
- 下載的配置檔案放置: /etc/sysconfig/jenkins 可根據需求對相關的引數進行修改(例如: 修改預設埠為8787)
## Type: integer(0:65535)
## Default: 8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8787"
- 日誌資訊檢視(可選) /var/lib/jenkins/
- 啟動jenkins
[[email protected] jenkins]# service jenkins start
Starting jenkins (via systemctl): [ 確定 ]
- 瀏覽器首次訪問Jenkins主頁
http://{IP地址}:8787
按照提示,去那個檔案下拿到超級管理員的密碼填寫即可
- 接著會提示安裝外掛,可以選擇建議外掛,也可以選擇自定義要安裝外掛,進入jenkins後也可以進行外掛安裝的,這裡先預設選擇
-
外掛安裝完,新建一個管理賬戶
-
完成管理賬戶後,進入Jenkins主頁
-
解除安裝(可選
1. 解除安裝軟體:rpm -e jenkins
2. 刪除遺留檔案: find / -iname jenkins | xargs -n 1000 rm -rf