1 安装包
apt-get install apache2 libapache2-svn
2 建立目录及库
mkdir -p /home/svn
svnadmin create /home/svn/rep1
svnadmin create /home/svn/rep2
chown www-data -R /home/svn/rep1
chown www-data -R /home/svn/rep2
2 编辑配置文件
vi /etc/apache2/mods-enabled/dav_svn.load内容如下
# Depends: dav
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/modules/mod_authz_svn.so
vi /etc/apache2/mods-enabled/dav_svn.conf,内容如下
<Location /svn/>
DAV svn
SVNParentPath /home/svn
SVNListParentPath On
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/dav_svn.passwd
AuthzSVNAccessFile /etc/subversion/dav_svn.authz
Require valid-user
</Location>
3 创建用户
htpasswd -c /etc/subversion/dav_svn.passwd admin
htpasswd /etc/subversion/dav_svn.passwd u1
htpasswd /etc/subversion/dav_svn.passwd u2
4 设置用户权限
vi /etc/subversion/dav_svn.authz
[/]
admin = r
[rep1:/]
u1 = rw
u2 = r
[rep2:/]
u2 = rw
u1 = r
5 重启服务
/etc/init.d/apache2 restart
6 访问
http://ip地址/svn/