环境:Centos 5.6 64位 IP:192.168.1.98
第一步:安装
1. 安装Apache
yum install –y httpd
2. 安装Subversion
yum install –y mod_dav_svn subversion
第二步配置apache
1:vi /etc/httpd/conf/httpd.conf
2:找到ServerName,去除前面的#号,并改为ServerName 192.168.1.98:80
3:执行service httpd restart
4:在windows下用浏览器,打开: http://192.168.1.98 可以看到apache主页
注意:如果有防火墙,需要配置,是外部能够访问它的80端口.如下输入
1:/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
2:/etc/rc.d/init.d/iptables save
3:/etc/init.d/iptables restart
第三步:配置subversion
1:cd /var/www
2:mkdir svn(如果svn不存在,则创建)
3:cd svn
4:svnadmin create repos
5:chown -R apache.apache repos
6:vi /etc/httpd/conf.d/subversion.conf
配置Localtion如下:注意默认是SVNParentPath,改为SVNPath
<Location /repos>
DAV svn
SVNPath /var/www/svn/repos
# Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# Require SSL connection for password protection.
# SSLRequireSSL
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /etc/svn-auth-conf
Require valid-user
# </LimitExcept>
</Location>
7:创建用户名和密码
输入:htpasswd -cm /etc/svn-auth-conf yourusername
8:service httpd restart
9:在windows下用浏览器,打开: http://192.168.1.98/repos 输入用户名和密码后,就可以进去了。
10:在windows下,使用TortoiseSVN的CheckOut,输入:http://192.168.1.98/repos 这样就可以用了
第四步:svn 访问控制列表
对于多人使用,需要针对不懂的人员使用不同访问权限控制,这段就是配置说明
1:vi /etc/httpd/conf.d/subversion.conf
增加一段:AuthzSVNAccessFile /etc/svn-acl-conf
结果如下
<Location /repos>
DAV svn
SVNPath /var/www/svn/repos
AuthzSVNAccessFile /etc/svn-acl-conf
# Limit write permission to list of valid users.
# <LimitExcept GET PROPFIND OPTIONS REPORT>
# Require SSL connection for password protection.
# SSLRequireSSL
AuthType Basic
AuthName "Subversion repos"
AuthUserFile /etc/svn-auth-conf
Require valid-user
# </LimitExcept>
</Location>
2: vi /etc/svn-acl-conf
内容如下
[repos:/]
allgroup = r
zdhsoft = rw
[/]
* = r
[groups]
devgroup = zdhsoft1,zdhsoft2,zdhsoft3
[repos:/]
zdhsoft = rw
@devgroup = r