1. 准备工作
checking for APR... no
configure: error: APR not found . Please read the documentation.
这时需要下载安装
APR(Apache Portable Runtime)
#tar -zxvf apr-1.4.2.tar.gz
#cd apr-1.4.2
#./configure
#make
#make install
之后重新configure可能会出现:
checking for APR-util... no
configure: error: APR-util not found . Please read the documentation.
这时需要下载安装
APR-util#tar -zxvf apr-util-1.3.9.tar.gz
#cd apr-util-1.3.9
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
#make
#make install
./configure仍提示APR-util not found,增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
之后可能出现configure: error: pcre-config for libpcre not found. PCRE is required and available from
http://pcre.org/这时需要下载PCRE
编译安装
#unzip -o pcre-8.10.zip
#cd pcre-8.10
#./configure --prefix=/usr/local/pcre
#make
#make install
继续安装Apache/httpd,./configure 时加上参数 --with-apr=/usr/local/apr/
--with-apr-util=/usr/local/apr-util/
--with-pcre=/usr/local/pcre,这个问题就解决了3. 安装Subversion
//解压SubVersion安装包 (root用户进行下面的操作)
# tar xvzf Subversion-1.6.13.tar.gz
//进入解压后的目录
# cd Subversion-1.6.13
//配置subversion安装
#./configure --with-apxs=/usr/local/apache/bin/apxs –prefix=/usr/local/subversion--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
--with-ssl --with-zlib–enable-maintainer-mode
这时可能会提示configure: error: Subversion requires SQLite
需要下载
sqlite-3.6.13 ,解压后,复制sqlite3.c到subvision源码文件sqlite-amalgamation目录下,如果没有sqlite-amalgamation目录,手动新建一个即可。
# make
//安装
# make install
//创建库文件所在的目录
# mkdir /home/svnroot
需要注意的是由于Apache和Subversion1.6.13之间的API不兼容,安装过程中会出现log_access verdict参数过多的问题,这时需要对Subversion的源码进行一些改进,具体请参照
《给apache 2.3.6+用的mod_authz_svn和mod_dav_svn》这篇文章,给出了详细的代码。或者可以从本文的附件中下载修改后的代码覆盖掉之前subversion1.6.13/subversion/ 下的mod_authz_svn和mod_dav_svn文件夹。
之后进行make即可。
4. 服务器的配置
在安装完成Subversion之后运行
#
svnadmin create /home/svnroot/repository/
建立一个新的svn资源库,若/home/svnroot/repository文件夹确实被建立,说明SVN被成功安装。
SVN资源库的访问有四种方式:
(1) 直接访问文件仓库(file://)
(2) 通过 WebDAV 协议访问(http://)
(3) 通过具有安全套接字(SSL)的 WebDAV 协议访问(https://)
(4) 通过自带协议访问(svn://)
(5) 通过具被SSH隧道保护的自带协议访问(svn+ssh://)
本文中采用第二种,其余情况可参照 Subversion http://wiki.ubuntu.org.cn/SubVersion
首先配置Apache的conf目录下的httpd.conf文件,为安全起见,提前备份该文件
//如果先安装apache,以下两行将自动添加,如未找到请手动添加
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
//添加以下内容到httpd.conf
<Location /svn>
DAV svn
SVNParentPath /home/svnroot/ //svn父目录
AuthzSVNAccessFile /home/apache/conf/svnauthz //权限配置文件
AuthType Basic //连接类型设置
AuthName “Subversion” //连接框提示
SVNListParentPath on //使其可以访问主目录
AuthUserFile /home/apache/conf/svnpasswd // 用户配置文件
Require valid-user //采用何种认证
</Location>保存之后,重启Apache。
5. 权限管理
在利用http连接SVN这种情况下起作用的两个文件
svnpasswd----存储用户名及其密码,密码是密文
svnauthz------设置用户可以访问哪个资源库或者是资源库下的哪个项目
添加用户htpasswd -c /home/apache/conf/svnpasswd shine
输入两次密码后完成对shine的添加,注意若svnpasswd文件已经存在,上述命令不需要参数 -c
之后依次添加其他用户
权限分配配置svnauthz文件,仅仅是简单的配置
设置shine可以访问repository下的所有项目
[repository:/]
shine = rw
设置shine不能修改其中的test项目
[repository:/test]
shine=r
设置完成之后既可以通过浏览器或者是Eclipse访问资源库。
可能会出现的问题:
You don't have permission to access /svn
on this server.首先输入的应该是资源库的名字比如说/svn/repository/
其次确保有读取该资源库的权限 chmod -R 700 XXXX
Internal Server Error此时查看有没有读取svnpasswd的权限,此处最好将svnpasswd和svnauthz文件放置于apache的conf文件夹下,避免莫名其妙的错误。。╮( ̄▽ ̄")╭ 同时要把httpd.conf配置时的路径同两个文件放置的路径一致
本文主要参照 http://www.yoyotown.com/?p=422 感谢原作者
Ctrl+Enter 发布
发布
取消