yum install httpdspring
檢查httpd是否安裝成功:apache
httpd -version
Server version: Apache/2.4.6 (CentOS)
Server built: Jul 18 2016 15:30:14服務器
安裝svnserve服務:ide
yum install subversionsvn
檢查svnserve是否安裝成功:ui
svnserve --version
svnserve, version 1.7.14 (r1542130)
compiled Nov 20 2015, 19:25:09orm
mod_dav_svn是apache服務器訪問svn的一個模塊。經過yum安裝:cmd
yum install mod_dav_svnit
安裝成功後,會有mod_dav_svn.so和mod_authz_svn.so兩個文件。io
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=httpfirewall-cmd --permanent --add-service=httpsfirewall-cmd --reload