jenkins升级
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
(1)查看war包所在的目录
[root@linux-node2 ~]
# rpm -ql jenkins
/etc/init
.d
/jenkins
/etc/logrotate
.d
/jenkins
/etc/sysconfig/jenkins
/usr/lib/jenkins
/usr/lib/jenkins/jenkins
.war
/usr/sbin/rcjenkins
/var/cache/jenkins
/var/lib/jenkins
/var/log/jenkins
(2)下载最新稳定版的war包
[root@linux-node2 ~]
# wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/war/2.46/jenkins.war
--2017-12-21 14:56:10-- https:
//mirrors
.tuna.tsinghua.edu.cn
/jenkins/war/2
.46
/jenkins
.war
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.6.178, 2402:f000:1:416:101:6:6:177
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.6.178|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 68663046 (65M) [application
/java-archive
]
Saving to: ‘jenkins.war’
36% [====================================================> ] 24,829,614 707KB
/s
eta 60s
|
当前jenkins版本为2.32.2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
(3)停止jenkins服务
[root@linux-node2 ~]
# service jenkins stop
Stopping jenkins (via systemctl): [ OK ]
(4)备份原来的war包,并拷贝最新版本war包到
/usr/lib/jenkins
目录下
[root@linux-node2 ~]
# cd /usr/lib/jenkins/
[root@linux-node2 jenkins]
# mv jenkins.war jenkins-2.32.2.war.bak
[root@linux-node2 jenkins]
# mv /root/jenkins.war .
[root@linux-node2 jenkins]
# service jenkins start
Starting jenkins (via systemctl): [ OK ]
[root@linux-node2 jenkins]
# netstat -tulnp |grep 8080
tcp6 0 0 :::8080 :::* LISTEN 47298
/java
成功升级到jenkins 2.46版本
|
2.jenkins备份
在jenkins界面创建一些项目,这里使用rsync,主要是为了保持备份的属性,如果使用scp或cp有时会导致文件属性的改变而导致jenkins异常。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
(1)创建备份目录
[root@linux-node2 ~]
# mkdir /data/backup/jenkins -p
(2)备份
/var/lib/jenkins
目录
[root@linux-node2 ~]
# rsync -raz --delete --progress /var/lib/jenkins /data/backup/jenkins/
(3)删除
/var/lib/jenkins/
[root@linux-node2 ~]
# rm -rf /var/lib/jenkins/
[root@linux-node2 ~]
# service jenkins restart
Restarting jenkins (via systemctl): Job
for
jenkins.service failed because the control process exited with error code. See
"systemctl status jenkins.service"
and
"journalctl -xe"
for
details.
[FAILED]
[root@linux-node2 ~]
# service jenkins status
JENKINS_HOME directory does not exist:
/var/lib/jenkins
(4)恢复备份
[root@linux-node2 ~]
# rsync -raz --delete /data/backup/jenkins/jenkins /var/lib/
[root@linux-node2 ~]
# service jenkins restart
Restarting jenkins (via systemctl): [ OK ]
|
版权声明:原创作品,谢绝转载。否则将追究法律责任
本文转自 IT_外卖小哥 51CTO博客,原文链接:http://blog.51cto.com/jinlong/2052932