本文共 1627 字,大约阅读时间需要 5 分钟。
公司现有一台SVN服务器:IP为:192.168.2.1 因为工作需要现在要做一台SVN备份的服务器.
SVN源服务器IP : 192.168.2.1 Windows服务器
SVN备份服务器IP : 192.168.2.2 Linux服务器
操作步骤:
备份服务器上面的操作 192.168.2.2
1 创建版本库
svnadmin create /data1/svn/test
2 修改SVN配置文件
cd /data1/svn/test/conf
vim svnserve.conf
19 anon-access = none
20 auth-access = write
27 password-db = passwd
36 authz-db = authz3 创建svn用户名密码(这里可以随意创建用户,只要和钩子文件对应就可以,不是只能svnsync用户)
vim passwd
test = 123456
4 修改认证权限文件
vim authz
[/]
test = rw
5 创建钩子文件
cd /data1/svn/test/hooks/
vim start-commit
限制只用syncuser用户才能提交版本修改到版本库
#!/bin/shUSER="$2"if [ "$USER" = "test" ];then exit 0fiecho "Only the test user may commit new revisions as this is a read-only, mirror repository." >&2 exit 1
chmod 755 start-commit
vim pre-revprop-change
让备份版本库使用同步用户修改修订版本属性
#!/bin/shUSER="$3"if [ "$USER" = "test" ];then exit 0fiecho "Only the test user may change revision properties as this is a read-only, mirror repository." >&2 exit 1
chmod 755 pre-revprop-change
6 以特殊端口启动SVN
svnserve --listen-port 3692 -d -r /data1/svn/ser/
源服务器操作192.168.2.1
注:SVN源和SVN备份必须要同时拥有test这个用户
1测试端口
telnet 192.168.2.1 3692
2 注册同步的备份版本库
cd C:\Program Files\VisualSVN Server\bin\
svnsync init svn://192.168.2.2:3692 https://192.168.2.1:80/svn/系统运维库/ --username test --password 123456
如果所有的配置正确,你一定会看到下面的输出:
Copied properties for revision 0. 现在你已经注册了镜像版本库与主版本库的同步,我们必须继续执行初始的同步,这样镜像版本库才和主版本库是一样的了。3 初始同步
我在SVN源服务器上创建了一个批处理文件,执行同步
"C:\Program Files\VisualSVN Server\bin\svn.exe" propdel svn:sync-lock --revprop -r 0 svn://192.168.2.2:3692"C:\Program Files\VisualSVN Server\bin\svnsync.exe" sync svn://192.168.2.2:3692 --username=test --password=123456pause
转载地址:http://clepb.baihongyu.com/