1、背景

接手一个前人维护的Jenkins系统,使用的是ver2.9的版本,也就是weekly的版本,比较老旧,而且担心哪天会不支持,决定替换成LTS版本,以绝后患。

其实升级方式有很多,因为不知道前人是如何安装的,采取最稳妥的替换war包的方式升级。

2、war的路径

一般情况下,war的安装路径在/usr/share/jenkins目录下。

不过也有部分人不喜欢安装在这里,可以通过系统管理(System management)–> 系统信息(System Info)查找.war的文件,如下图:

3、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

4、升级Jenkins

  1. 停止Jenkins服务(记得备份原来的jenkins.war,以防万一)
    http://jenkinsIP:port/exit

  1. 替换最新的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.
文档更新时间: 2019-04-04 09:25   作者:李延召