安装apache服务器
[root@localhost ~]# yum install httpd -y
[root@localhost ~]# httpd -version
Server version: Apache/2.4.6 (CentOS)
Server built: Apr 12 2017 21:03:28
安装svn
[root@localhost ~]# yum install mod_dav_svn subversion -y
[root@localhost ~]# svnserve –version
svnserve,version 1.7.14 (r1542130)
compiled Nov 20 2015,19:25:09
Copyright (C) 2013 The Apache Software Foundation.
This software consists of contributions made by many people; see the NOTICE
file for more information.
Subversion is open source software,see http://subversion.apache.org/
The following repository back-end (FS) modules are available:
- fs_base : Module for working with a Berkeley DB repository.
- fs_fs : Module for working with a plain file (FSFS) repository.
Cyrus SASL authentication is available.
[root@localhost ~]# ls /etc/httpd/modules/ | grep svn
mod_authz_svn.so
mod_dav_svn.so
apache下配置svn
[root@localhost ~]# vi /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /var/www/svn #svn的根目录SSLRequireSSL #SSL访问权限
AuthType Basic #Basic认证方式
AuthName "Authorization SVN" #认证时显示的信息
AuthUserFile /var/www/svn/passwd #用户文件&密码
AuthzSVNAccessFile /var/www/svn/authz #访问权限控制文件
Require valid-user #要求真实用户,不能匿名
</Location>
创建仓库
[root@localhost ~]# mkdir /var/www/svn
[root@localhost ~]# svnadmin create /var/www/svn/testrep
[root@localhost ~]# ls /var/www/svn/testrep/
conf db format hooks locks README.txt
创建权限文件
[root@localhost ~]# touch /var/www/svn/passwd
[root@localhost ~]# touch /var/www/svn/authz
安装PHP,iF.SVNAdmin使用PHP写的,因此我们需要安装PHP
[root@localhost ~]# yum install PHP -y
下载svnadmin
[root@localhost ~]# cd /usr/local/src
[root@localhost src]# wget https://nchc.dl.sourceforge.net/project/ifsvnadmin/svnadmin-1.6.2.zip
解压、移动
[root@localhost src]# unzip svnadmin-1.6.2.zip
[root@localhost src]# cp -r iF.SVNAdmin-stable-1.6.2/ /var/www/html/svnadmin
进入目录,修改data权限
[root@localhost html]# cd /var/www/html/svnadmin
[root@localhost html]# chmod -R 777 data
修改服务
[root@localhost ~]# vim /etc/sysconfig/svnserve
OPTIONS=”-r /var/svn”
======> OPTIONS=”-r /var/www/svn”
apache服务命令 启动: systemctl start httpd.service 开机自启动:systemctl enable httpd.service 重启: systemctl restart httpd.service