lomg 发表于 2018-1-7 15:41:11

Jenkins技巧:如何更新Jenkins到最新版本

  -----------------------------------------------------------------
  原创博文,未经作者允许禁止转载。
  博主:疲惫的豆豆
  链接: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的文件,如下图:
https://images2015.cnblogs.com/blog/538639/201706/538639-20170608141019825-639432364.png

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
https://images2015.cnblogs.com/blog/538639/201706/538639-20170608142556043-565808655.png
  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
页: [1]
查看完整版本: Jenkins技巧:如何更新Jenkins到最新版本