记一次svn迁移
近期业务需要,把公司内windows机器上VisualSVN的数据,迁移到云端linux机器。
一、安装svn
1、安装svn
yum install -y subversion
2、创建库
mkdir /root/data/svn/repos cd /root/data/svn/repos svnadmin create base
3、配置文件编辑
vim /root/data/svn/repos/base/conf/svnserve.conf 加入
anon-access=none auth-access=write password-db=passwd authz-db=authz realm=base
vim authz 加入
[hip:/] chon=rw * =
vim passwd 加入
chon=123456
4、启动svn服务
svnserve -d -r /root/data/svn/repos/base --listen-port 3600
5、用 svn://127.0.0.1:3600/base访问svn
测试是否成功启动
telnet 127.0.0.1 3600 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. ( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops
depth log-revprops atomic-revprops partial-replay ) ) )
表示启动成功。
但此种方式不支持http访问,下面做http的配置;
二、添加http访问支持
1、安装 httpd 和 mod_dav_svn
yum install -y httpd mod_dav_svn
2、配置httd,进入 vim /etc/httpd/conf.d/subversion.conf ,添加
<Location /svn> DAV svn SVNParentPath /root/data/svn/repos AuthType Basic AuthName "Authorization SVN" AuthzSVNAccessFile /root/data/svn/conf/authz AuthUserFile /root/data/svn/conf/httppassword Require valid-user </Location>
其中, /root/data/svn/repos 为svn库的根目录,为支持多个库的情况,应把权限文件放在 repos之外。
3、权限 vim /root/data/svn/conf/authz
[base:/] chon=rw * =
4、加httpd的用户权限
首次 htpasswd -c /root/data/svn/Repositories/conf/httppassword chon 之后 htpasswd -m /root/data/svn/Repositories/conf/httppassword chon2 htpasswd -m /root/data/svn/Repositories/conf/httppassword chon3 htpasswd -m /root/data/svn/Repositories/conf/httppassword chon4
5、修改目录所有者,以及文件权限
chown apache.apache /root/data/svn/repos/base -R
chmod -R 777 /root/data/svn/repos/base
6、重启 httpd
service httpd restart
注意,httpd的启动,与 svnserve -d -r /root/data/svn/repos/base --listen-port 3600 并无关联,是两种相对独立的服务方式。
7、访问 http://47.18.20.88:9095/svn/bast/,输入账号密码,输出为, 表示成功
hip - Revision 0: /
三、开始迁移操作
1、dump出原 VisualSVN 中各个svn库,命令如下
svnadmin dump d:\Repositories\operate > e:\svn_dump\operate.dump svnadmin dump d:\Repositories\platform > e:\svn_dump\platform.dump svnadmin dump d:\Repositories\product > e:\svn_dump\product.dump svnadmin dump d:\Repositories\sound > e:\svn_dump\sound.dump svnadmin dump d:\Repositories\source > e:\svn_dump\source.dump
2、把导出的文件上传至linux服务器,依次执行
mkdir /root/data/svn/repos/sound svnadmin create /root/data/svn/repos/sound svnadmin load /root/data/svn/repos/sound < /data/sound.dump
svnadmin dump d:\Repositories\art > e:\svn_dump\art.dump svnadmin dump d:\Repositories\code > e:\svn_dump\code.dump svnadmin dump d:\Repositories\games > e:\svn_dump\games.dump svnadmin dump d:\Repositories\operate > e:\svn_dump\operate.dump svnadmin dump d:\Repositories\platform > e:\svn_dump\platform.dump svnadmin dump d:\Repositories\product > e:\svn_dump\product.dump svnadmin dump d:\Repositories\sound > e:\svn_dump\sound.dump svnadmin dump d:\Repositories\source > e:\svn_dump\source.dump svnadmin load /root/data/svn/repos/sound < /root/data/svn/dump_95/sound.dump