1、安装svn
# yum install subversion mod_dav_svn subversionDependencies Resolved
2、建立svn 文件夹
# mkdir /data/subversion
3、建立svn项目
# svnadmin create /data/subversion/first_item
4、开端口
# vi /etc/sysconfig/iptables
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3690 -j ACCEPT
# service iptables restart
5、编辑 配置文件
# vi /data/subversion/first_item/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz
realm = My Repository
6、编辑 authz
# vi /data/subversion/first_item/conf/authz
之前的注销,在最后增加
[/]
huang=rw
7、编辑 passwd 文件
# vi /data/subversion/first_item/conf/passwd
[users]
huang=123456
8、编辑 提交版本后自动发邮件的钩子程序
# vi /data/subversion/first_item/hooks/post-commit
#!/bin/sh
REPOS=”$1″
REV=”$2″
export LANG=en_US.UTF-8
# mailer.py commit “$REPOS” “$REV” /path/to/mailer.conf
/usr/bin/svnnotify –repos-path “$1” –revision “$2” –to h@xxx.com –from noreply@xxx.com –handler “HTML::ColorDiff” –with-diff –smtp smtp.exmail.qq.com –smtp-user noreply@xxx.com –smtp-pass xxxx –smtp-authtype LOGIN –svnlook /usr/bin/svnlook –subject-prefix ‘[API]’ >> /var/log/svn.log
9、编辑 提交svn的日志不能为空的脚本
# vi /data/subversion/first_item/hooks/pre-commit
#!/bin/sh
export LANG=zh_CN.UTF-8
REPOS=”$1″
TXN=”$2″
SVNLOOK=/usr/bin/svnlook
LOGMSG=`$SVNLOOK log “$REPOS” -t “$TXN” | findstr “……….” `
if [ “$LOGMSG” > nul ];
then
echo -e “Log message can’t be empty! you must input more than 5 chars as comment!.” 1>&2
exit 1
fi
exit 0
10、启动svn
# /usr/bin/svnserve -d -r /data/subversion/
11、加入自动启动脚本
# vi /etc/rc.d/rc.local
在最底下加入
/usr/bin/svnserve -d -r /data/subversion/
12、测试svn
# ps aux |grep svn
其他:
参考网址 http://www.ha97.com/4467.html