CentOS 6.5 Apache+SVN配置

yum -y install subversion #安装SVN

svnserve -- version #查看svn版本信息确定是否安装

yum -y install httpd #安装Apache

yum -y install mod_dav_svn #安装Apache的SVN支持

mkdir -p /var/www/svn #创建SVN目录

svnadmin create /var/www/svn/repos #创建repos版本库

htpasswd -c /etc/httpd/conf.d/passwd.dav_svn admin #创建用户密码文件并添加用户

vi /etc/httpd/conf.d/authz.dav_svn #编辑用户权限配置

[groups]    #权限分组
manager=admin

[/]    #根目录
@manager=rw    #manager组有读写权限

[repos:/]    #repos库
*=r    #所有人都有读取权限

vi /etc/httpd/conf.d/subversion.conf #编辑Apache的SVN配置

<Location /svn>
    DAV svn
    SVNParentPath /var/www/svn
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /etc/httpd/conf.d/passwd.dav_svn
    AuthzSVNAccessFile /etc/httpd/conf.d/authz.dav_svn
    Require valid-user
</Location>
ServerName localhost:80 #取消注释,否则Apache启动有警告

chown -R apache.apache /var/www/svn/repos #配置Apache对版本库的访问权限

iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT #防火墙开启80端口

/etc/init.d/iptables save #拷贝防火墙规则保存

chcon -R -t httpd_sys_content_t /var/www/svn/repos #添加Apache对版本库目录的selinux安全策略

chkconfig httpd on #系统启动时Apache自动运行

service httpd start #启动Apache