首页 > 系统相关 >jenkins 从CentOS6 迁移到CentOS7记录

jenkins 从CentOS6 迁移到CentOS7记录

时间:2023-02-08 18:55:22浏览次数:53  
标签:svn sudo CentOS7 CentOS6 https jenkins 迁移 yes

 

 

一、备份

任何迁移操作一定要做好

 

二、CentOS7 安装jenkins

sudo wget -O /etc/yum.repos.d/jenkins.repo \
    https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo yum upgrade
# Add required dependencies for the jenkins package
sudo yum install java-11-openjdk
sudo yum install jenkins
sudo systemctl daemon-reload

官方文档:https://www.jenkins.io/doc/book/installing/linux/#red-hat-centos

 

三、数据迁移

因为jenkins所有配置、数据为文件,所以基本拷贝相关目录就可以了

1.  迁移jenkins主目录

 主目录默认路径:/var/lib/jenkins

   注意:实际以自己的jenkins : Dashboard > Manage Jenkins > Configure System 显示为准

2. 迁移jenkins安装包

 这里建议先使用旧的jenkins.war ,确认没问题后,可以在新服务器通过管理平台升级

 安装包路径:/usr/share/java/jenkins.war 

3. 第三方安装包:svn

这里比较常见的一个问题是,svn证书、svn用户等问题,

因为jenkins默认以jenkins用户启动,所以需要在jenkins用户下保存密码,

可以临时修改jenkins等用户,

vi /etc/passwd

修改 jenkins:x:996:991:Jenkins Automation Server:/var/lib/jenkins:/bin/false

jenkins:x:996:991:Jenkins Automation Server:/var/lib/jenkins:/bin/bash

登陆jenkins

# 登陆jenkins用户
su jenkins

# 执行svn命令如下
svn ls --username=svnuser https://domain.com/svn/

# 根据提示  p 永久信任
Error validating server certificate for 'https://domain.com/svn/':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
 - The certificate hostname does not match.
Certificate information:
 - Hostname: WIN-SVN
 - Valid: from Tue, 08 Aug 2007 12:20:58 GMT until Fri, 06 Aug 2037 12:20:58 GMT
 - Issuer: WIN-SVN
 - Fingerprint: 23:65:af:c7:c0:d0:b4:83:f3:ff:e3:4b:9c:d5:6f:97:51:35:30:24
(R)eject, accept (t)emporarily or accept (p)ermanently? p

# 保存svn密码

ATTENTION!  Your password for authentication realm:

   <https://domain.com> VisualSVN Server

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/var/lib/jenkins/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? 
Please type 'yes' or 'no': yes

 

四、启动服务

# 设置开机自动启动
sudo systemctl enable jenkins

# 启动jenkins服务
sudo systemctl start jenkins

# 检查jenkins状态
sudo systemctl status jenkins

 

五、登陆jenkins

如果迁移成功,登陆以后所有等任务、配置都会跟之前的配置一样,

但实际使用中可能还会有部分插件、定制组建不兼容的问题,根据提示一一解决就好。

 

标签:svn,sudo,CentOS7,CentOS6,https,jenkins,迁移,yes
From: https://www.cnblogs.com/yuejunasia/p/17102972.html

相关文章