-----------------------------------------------------------------
原創博文,未經作者允許禁止轉載。
博主:疲憊的豆豆
鏈接:http://www.cnblogs.com/dzblog/p/6962000.html
----------------------------------------------------------------
更新:
2017-06-19:因個人需要替換成最新的weekly版本,確保操作步驟沒問題。
背景
接手一個前人維護的Jenkins系統,使用的是ver2.9的版本,也就是weekly的版本,比較老舊,而且擔心哪天會不支持,決定替換成LTS版本,以絕后患。
其實升級方式有很多,因為不知道前人是如何安裝的,采取最穩妥的替換war包的方式升級。
war的路徑
一般情況下,war的安裝路徑在/usr/share/jenkins目錄下。
不過也有部分人不喜歡安裝在這里,可以通過系統管理(System management)--> 系統信息(System Info)查找.war的文件,如下圖:
war下載
先列出官網地址:https://jenkins.io/download/,可能會有GFW的原因導致被屏蔽。
我們可以使用如下幾個鏈接去下載:
- https://updates.jenkins-ci.org/download/war/
- http://mirror.xmission.com/jenkins/war-stable/
- http://ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/war-stable/
- https://mirrors.tuna.tsinghua.edu.cn/jenkins/ (這個是清華的鏡像鏈接)
比如說我升級的是最新的LTS版本:2.46.3,路徑:Index of /jenkins/war-stable-rc/2.46.3/
地址:https://mirrors.tuna.tsinghua.edu.cn/jenkins/war-stable-rc/2.46.3/jenkins.war
ubuntu系統可以使用wget下載
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/war-stable-rc/2.46.3/jenkins.war
升級Jenkins
1. 停止Jenkins服務(記得備份原來的jenkins.war,以防萬一)
http://jenkinsIP:port/exit
2. 替換最新的war包,並啟動jenkins(一般也就java -jar jenkins.war即可)
參考:
https://stackoverflow.com/questions/11062335/update-jenkins-from-a-war-file的這句話:
You can overwrite the existing jenkins.war file with the new one and then restart Jenkins.
This file is usually located in /usr/share/jenkins.
If this is not the case for your system, in Manage Jenkins -> System Information, it will display the path to the .war file under executable-war.
END