apache+SVN

1.安装apache
1.1 apache安装
tar jxvf apr-1.4.6.tar.bz2
[root@open-source src]# cd apr-1.4.6
[root@open-source apr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@open-source apr-1.4.6]# make && make install

[root@open-source src]# tar zxvf apr-util-1.3.9.tar.gz
[root@open-source src]# cd apr-util-1.3.9
[root@open-source apr-util-1.3.9]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@open-source apr-util-1.3.9]# make && make install

[root@open-source src]# tar zxvf httpd-2.4.7.tar.gz ^C
[root@open-source src]# cd httpd-2.4.7
[root@open-source httpd-2.4.7]# ./configure --prefix=/usr/local/app/apache2 --enable-dav --enable-so --enable-maintainer-mode\
--enable-maintainer-mode --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre
[root@open-source httpd-2.4.7]# make && make install

1.2安装SVN
[root@open-source src]# wget http://mirror.bit.edu.cn/apache/subversion/subversion-1.8.5.tar.gz
[root@open-source src]# tar zxf subversion-1.8.5.tar.gz                                    
[root@open-source src]# wget http://www.sqlite.org/2013/sqlite-amalgamation-3080200.zip
[root@open-source src]# unzip sqlite-amalgamation-3080200.zip

[root@open-source src]# mv sqlite-amalgamation-3080200 subversion-1.8.5/sqlite-amalgamation
[root@open-source src]# cd subversion-1.8.5
[root@open-source subversion-1.8.5]# ./configure --with-apxs=/usr/local/app/apache2/bin/apxs \
--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
[root@open-source subversion-1.8.5]# make
[root@open-source subversion-1.8.5]# make install

apache 配置文件添加
[root@open-source ~]# /usr/local/app/apache2/conf/httpd.conf

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so

#svn
<Location /svn >
DAV svn
SVNParentPath /data/svnrepo
AuthzSVNAccessFile /data/svnrepo/authaccess.conf
AuthUserFile /data/svnrepo/authuser.conf
AuthType  Basic
AuthName "GY SVN Repository"
Require valid-user
</Location>

测试apache配置文件时提示没有mod_dav_svn.so和mod_auth_svn.so模块,这两个模块要去svn源码目录下去拷贝
[root@open-source ~]# /usr/local/app/apache2/bin/apachectl -t  
httpd: Syntax error on line 153 of /usr/local/app/apache2/conf/httpd.conf: Cannot load modules/mod_dav_svn.so into server:
/usr/local/app/apache2/modules/mod_dav_svn.so: cannot open shared object file: No such file or directory

httpd: Syntax error on line 154 of /usr/local/app/apache2/conf/httpd.conf: Cannot load modules/mod_authz_svn.so into server:
/usr/local/app/apache2/modules/mod_authz_svn.so: cannot open shared object file: No such file or directory

[root@open-source src]# cd /usr/src/subversion-1.8.5
[root@open-source subversion-1.8.5]# find ./ -name "mod_dav_svn.so"  #查找mod_dav_svn.so模块目录
./subversion/mod_dav_svn/.libs/mod_dav_svn.so

#拷贝模块到apache的模块目录下
[root@open-source subversion-1.8.5]# cp -p ./subversion/mod_dav_svn/.libs/mod_dav_svn.so /usr/local/app/apache2/modules/
[root@open-source subversion-1.8.5]# find ./ -name "mod_authz_svn.so"  #查找mod_authz_svn.so模块目录                                                              
./subversion/mod_authz_svn/.libs/mod_authz_svn.so
#拷贝模块到apache的模块目录下
[root@open-source subversion-1.8.5]# cp ./subversion/mod_authz_svn/.libs/mod_authz_svn.so /usr/local/app/apache2/modules/
[root@open-source subversion-1.8.5]# /usr/local/app/apache2/bin/apachectl -t                                            
Syntax OK
[root@open-source subversion-1.8.5]# /usr/local/app/apache2/bin/apachectl restart

[root@open-source ~]# cd /data/svnrepo/
[root@open-source svnrepo]# svnadmin create /data/svnrepo/yunwei 创建版本库
[root@open-source svnrepo]# chown -R nagios.nagios /data/svnrepo/yunwei
[root@open-source svnrepo]# touch authuser.conf   #存放用户名密码
[root@open-source svnrepo]# touch authaccess.conf   #认证目录
[root@open-source svnrepo]# chown -R nagios.nagios /data/svnrepo/yunwei  #目录改为apache的权限

[root@open-source svnrepo]# /usr/local/app/apache2/bin/htpasswd -c -b /data/svnrepo/authuser.conf username password  #创建用户名 密码
Adding password for user lyf

[root@open-source svnrepo]# vim authaccess.conf
[groups]
svnadmin=harry,tom
yunwei=harry,john

[yunwei:/]
@svnadmin=rw
@yunwei=rw