1.从windows导出svn文件
bat脚本
@echo off
svnadmin dump E:\Repositories\3goodsoft_carbon_admin > D:/test/3goodsoft_carbon_admin.dump
svnadmin dump E:\Repositories\3goodsoft_android > D:/test/3goodsoft_android.dump
svnadmin dump E:\Repositories\3goodsoft_carbon_cloud > D:/test/3goodsoft_carbon_cloud.dump
svnadmin dump E:\Repositories\3goodsoft_carbon_web > D:/test/3goodsoft_carbon_web.dump
svnadmin dump E:\Repositories\3goodsoft_code > D:/test/3goodsoft_code.dump
svnadmin dump E:\Repositories\3goodsoft_doc > D:/test/3goodsoft_doc.dump
svnadmin dump E:\Repositories\3goodsoft_operate_web > D:/test/3goodsoft_operate_web.dump
svnadmin dump E:\Repositories\3goodsoft_shrk_web > D:/test/3goodsoft_shrk_web.dump
svnadmin dump E:\Repositories\3goodsoft_shzxglpt > D:/test/3goodsoft_shzxglpt.dump
svnadmin dump E:\Repositories\3goodsoft_smallroutine > D:/test/3goodsoft_smallroutine.dump
svnadmin dump E:\Repositories\3goodsoft_u3d > D:/test/3goodsoft_u3d.dump
svnadmin dump E:\Repositories\3goodsoft_ui > D:/test/3goodsoft_ui.dump
svnadmin dump E:\Repositories\accidentprevention > D:/test/accidentprevention.dump
svnadmin dump E:\Repositories\anrika > D:/test/anrika.dump
svnadmin dump E:\Repositories\code-generator > D:/test/code-generator.dump
svnadmin dump E:\Repositories\construction > D:/test/construction.dump
svnadmin dump E:\Repositories\construction_view > D:/test/construction_view.dump
svnadmin dump E:\Repositories\czrailway > D:/test/czrailway.dump
svnadmin dump E:\Repositories\czrailway_view > D:/test/czrailway_view.dump
svnadmin dump E:\Repositories\ds > D:/test/ds.dump
svnadmin dump E:\Repositories\kg-project > D:/test/kg-project.dump
svnadmin dump E:\Repositories\kg-project-admin > D:/test/kg-project-admin.dump
svnadmin dump E:\Repositories\kg-project-PC > D:/test/kg-project-PC.dump
svnadmin dump E:\Repositories\oneplusx > D:/test/oneplusx.dump
svnadmin dump E:\Repositories\operate > D:/test/operate.dump
svnadmin dump E:\Repositories\qrcode > D:/test/qrcode.dump
svnadmin dump E:\Repositories\shkt > D:/test/shkt.dump
svnadmin dump E:\Repositories\shzxglpt > D:/test/shzxglpt.dump
svnadmin dump E:\Repositories\u3d > D:/test/u3d.dump
svnadmin dump E:\Repositories\zjxh > D:/test/zjxh.dump
yum install subversion
安装完成后创建对应的Windows仓库,每一个都得创建
svnadmin create /home/svn/Repositories/xxx
然后执行svn脚本 svn_sy.sh ,脚本中的路径更改为自己的
#!/bin/bash
DIR_HOME="/home/test"
SVN_HOME="/home/svn/Repositories"
files=`cd $DIR_HOME;ls`
pro="test android BackEnd DevOps ios pigcms Product UI wechat WorkLogs"
for file in $files;
do
#get all *dump files
project=`echo $file | sed -n '/.*\.dump/p' | cut -d '.' -f1`
if [ "$project"x != ""x ];then
if [ "$project" = "$pro" ];then
continue
fi
create_dir="svnadmin create $SVN_HOME/$project"
svn_load="svnadmin load $SVN_HOME/$project < $DIR_HOME/$project.dump"
execute create_dir order
echo $create_dir
eval $create_dir
execute svn_load order
echo $svn_load
eval $svn_load
fi
done
每个仓库的conf目录下都有自己authz,passwd和svnserve.conf文件,不好管理
拷贝一份到svn根目录下。然后修改所有仓库下的是svnserve.conf指向根目录下的authz和passwd
修改内容如下
[general]
anon-access= none
auth-access= write
password-db= /home/svn/passwd
authz-db= /home/svn/authz
将windows的htpasswd文件和groups.conf拷贝过来
修改根目录的authz,将groups.conf目录下的组信息内容拷过去
然后到每个子仓库下的VisualSVN-GlobalWinAuthz.ini下的权限信息拷贝到authz中
注意前缀要加上仓库名和冒号
赋予authz
、httppasswd
、passwd
文件权限
如果直接使用svn的话,修改下passwd,重新创建用户就行。
然后启动svn
svnserve -d -r /根目录--listen-port 端口号
起来后使用 svn: // 路径就可以访问了,我这边之前是http的,所以需要通过http访问
安装httpd和mod_dav_svn模块
yum install -y mod_dav_svn
yum install -y http
到httpd配置目录下创建文件内容如下
vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /home/svn/Repositories
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /home/svn/httppasswd
AuthzSVNAccessFile /home/svn/authz
Satisfy all
Require valid-user
</Location>
systemctl enable httpd
systemctl start httpd
如果不想使用80端口的话可以修改/etc/httpd/conf/httpd.conf
将Listen 80 改为自己想要的端口
因为http密码是加密过后的所以需要生成
第一次创建
htpasswd -cm /home/svn/svn-auth-conf 用户名
修改密码或者添加用户
htpasswd -m /home/svn/svn-auth-conf 用户名
将生成的密码移动到 httppasswd 中
然后重启httpd
service httpd restart
添加防火墙放行策略:
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
firewall-cmd --zone=public --add-port=端口号/tcp --permanent
AH01620: Could not open password file:
vi /etc/selinux/config
将SELINUX的值设置为disabled
更改完之后需要重启服务器
svn自启动
脚本:
#!/bin/bash
##普通启动命令
svnserve -d -r /home/svn/Repositories
service httpd restart
iptables -I INPUT -p tcp --dport 1443 -j ACCEPT
chmod 777 /etc/rc.d/init.d/svn_start.sh
赋权
chmod 777 /etc/rc.d/rc.local
然后自启动就配置好了