标签:svn centos7
yum install httpd
检查httpd是否安装成功:
httpd -version
Server version: Apache/2.4.6 (CentOS)
Server built: Jul 18 2016 15:30:14
安装svnserve服务:
yum install subversion
检查svnserve是否安装成功:
svnserve --version
svnserve, version 1.7.14 (r1542130)
compiled Nov 20 2015, 19:25:09
mod_dav_svn是apache服务器访问svn的一个模块。通过yum安装:
yum install mod_dav_svn
安装成功后,会有mod_dav_svn.so和mod_authz_svn.so两个文件。
find / -name mod_dav_svn.so
/usr/lib64/httpd/modules/mod_dav_svn.so
find / -name mod_authz_svn.so
/usr/lib64/httpd/modules/mod_authz_svn.so
mkdir /var/svn
svnadmin create /var/svn/spring-hello-world
ll /var/svn/
drwxr-xr-x. 6 root root 80 Nov 10 14:42 spring-hello-world
ll /var/svn/Project/
drwxr-xr-x. 2 root root 51 Nov 10 14:42 conf
drwxr-sr-x. 6 root root 4096 Nov 10 14:42 db
-r--r--r--. 1 root root 2 Nov 10 14:42 format
drwxr-xr-x. 2 root root 4096 Nov 10 14:42 hooks
drwxr-xr-x. 2 root root 39 Nov 10 14:42 locks
-rw-r--r--. 1 root root 229 Nov 10 14:42 README.txt
修改svn仓库的用户组为apache:
chown -R apache:apache /var/svn/spring-hello-world
创建用户文件passwd:
touch /var/svn/passwd #创建用户文件
htpasswd /var/svn/passwd admin #创建用户admin
htpasswd /var/svn/passwd guest #创建用户guest
cat /var/svn/passwd
admin:$apr1$UCkPzZ2x$tnDk2rgZoiaURPzO2e57t0
guest:$apr1$vX1RIUq6$OKS1bqKZSptzsPDYUOJ5x.
创建权限文件authz:
cp /var/svn/spring-hello-world/conf/authz /var/svn/authz
cat /var/svn/authz
[/]
admin = rw
guest = r
touch /etc/httpd/conf.d/subversion.conf
cat /etc/httpd/conf.d/subversion.conf
<Location /svn>
DAV svn
SVNParentPath /var/svn
AuthType Basic
AuthName "Authorization SVN"
AuthzSVNAccessFile /var/svn/authz
AuthUserFile /var/svn/passwd
Require valid-user
</Location>
systemctl start httpd.service
客户端使用http://IP/svn/Project就可以访问刚才建立的svn仓库了。 如果返回403错误,可能是防火墙问题。增加防火墙规则:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
标签:svn centos7
原文地址:http://blog.51cto.com/12276890/2096357