CentOS 6.5安装SVN
时间:2016-04-02 03:35 来源:linux.it.net.cn 作者:IT
1.安装SVN服务端:
rpm -qa | grep subversion
yum install subversion
2.建立版本库目录:
mkdir -p /svn/project/test1
mkdir -p /svn/project/test2
3.建立版本库:
svnadmin create /svn/project/test1
svnadmin create /svn/project/test2
4.添加和配置test1版本库的用户和权限:
cd /svn/project/test1/conf
vim svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = test1
vim passwd
[users]
test1aaa = aaapasswd
test1bbb = bbbpasswd
test1ccc = cccpasswd
share = sharepasswd
vim authz
[groups]
admin = test1aaa,test1bbb,test1ccc
share= share
[test1:/]
@admin = rw
* = r
#test1是此SVN访问的根目录地址,为配置对此目录的权限。
[test1:/share]
@share = rw
* = r
#test1/share是此SVN访问的根目录地址,为配置对此目录的权限。
5.添加和配置test2版本库的用户和权限:
cd /svn/project/test2/conf
vim svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = test2
vim passwd
[users]
test2aaa = aaapasswd
test2bbb = bbbpasswd
test2ccc = cccpasswd
share = sharepasswd
vim authz
[groups]
admin = test2aaa,test2bbb,test2ccc
[test2:/]
@admin=rw
* =r
#test2是此SVN访问的根目录地址,为配置对此目录的权限。
[test1:/share]
@share = rw
* = r
#test2/share是此SVN访问的根目录地址,为配置对此目录的权限。
6.启动SVN服务:
svnserve -d -r /svn/project --log-file /svn/project/svn.log --pid-file /svn/project/svn.pid
ps -aux | grep svnserve
netstat -anptu | grep :3690
7.测试:
windows:
svn://localhost/test1
svn://localhost/test1/share
svn://localhost/test2
svn://localhost/test2/share
Linux:
svn://localhost/test1
svn://localhost/test1/share
svn://localhost/test2
svn://localhost/test2/share
#svn列表
svn://localhost/test1
svn://localhost/test1/share
svn://localhost/test2
svn://localhost/test2/share
#svn检出
svn update
#svn更新
8.强制用户提交SVN输入日志信息:
cd /svn/project/test1/hooks
vim pre-commit
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
#根据SVN安装目录而定(find / -name svnlook)
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 4 ];
#至少4个字符
then
echo "Log message can't be empty! you must input more than 4 chars as comment!." 1>&2
exit 1
fi
chmod 755 pre-commit
9.防火墙开启3690端口:
iptables -A INPUT -p tcp --dport 3690 -j ACCEPT
如果需要更多svn版本库访问,只需要创建相应的版本库目录,配置参考第四、五步!
svnadmin create /svn/project/test3
svnadmin create /svn/project/test4
...
...
...
svnadmin create /svn/project/test100
(责任编辑:IT)
1.安装SVN服务端: rpm -qa | grep subversion yum install subversion 2.建立版本库目录: mkdir -p /svn/project/test1 mkdir -p /svn/project/test2 3.建立版本库: svnadmin create /svn/project/test1 svnadmin create /svn/project/test2 4.添加和配置test1版本库的用户和权限: cd /svn/project/test1/conf vim svnserve.conf [general] anon-access = none auth-access = write password-db = passwd authz-db = authz realm = test1 vim passwd [users] test1aaa = aaapasswd test1bbb = bbbpasswd test1ccc = cccpasswd share = sharepasswd vim authz [groups] admin = test1aaa,test1bbb,test1ccc share= share [test1:/] @admin = rw * = r #test1是此SVN访问的根目录地址,为配置对此目录的权限。 [test1:/share] @share = rw * = r #test1/share是此SVN访问的根目录地址,为配置对此目录的权限。 5.添加和配置test2版本库的用户和权限: cd /svn/project/test2/conf vim svnserve.conf [general] anon-access = none auth-access = write password-db = passwd authz-db = authz realm = test2 vim passwd [users] test2aaa = aaapasswd test2bbb = bbbpasswd test2ccc = cccpasswd share = sharepasswd vim authz [groups] admin = test2aaa,test2bbb,test2ccc [test2:/] @admin=rw * =r #test2是此SVN访问的根目录地址,为配置对此目录的权限。 [test1:/share] @share = rw * = r #test2/share是此SVN访问的根目录地址,为配置对此目录的权限。 6.启动SVN服务: svnserve -d -r /svn/project --log-file /svn/project/svn.log --pid-file /svn/project/svn.pid ps -aux | grep svnserve netstat -anptu | grep :3690 7.测试: windows: svn://localhost/test1 svn://localhost/test1/share svn://localhost/test2 svn://localhost/test2/share Linux: svn://localhost/test1 svn://localhost/test1/share svn://localhost/test2 svn://localhost/test2/share #svn列表 svn://localhost/test1 svn://localhost/test1/share svn://localhost/test2 svn://localhost/test2/share #svn检出 svn update #svn更新 8.强制用户提交SVN输入日志信息: cd /svn/project/test1/hooks vim pre-commit #!/bin/sh REPOS="$1" TXN="$2" SVNLOOK=/usr/bin/svnlook #根据SVN安装目录而定(find / -name svnlook) LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c` if [ "$LOGMSG" -lt 4 ]; #至少4个字符 then echo "Log message can't be empty! you must input more than 4 chars as comment!." 1>&2 exit 1 fi chmod 755 pre-commit 9.防火墙开启3690端口: iptables -A INPUT -p tcp --dport 3690 -j ACCEPT 如果需要更多svn版本库访问,只需要创建相应的版本库目录,配置参考第四、五步! svnadmin create /svn/project/test3 svnadmin create /svn/project/test4 ... ... ... svnadmin create /svn/project/test100 (责任编辑:IT) |