天天看点

linux下SVN+apache搭建

下载包

1. 编译apache

tar zxvf httpd-2.2.11.tar.gz

cd  httpd-2.2.11

./configure   --enable-dav --enable-dav-fs --enable-so   --enable-ssl --enable-maintainer-mode -prefix=/usr/local/apache2   --enable-mods-shared=all

make  && make install

问题: 在centos6系统中,如果增加了 --enable-ssl 会一直报错编译不成功,即使我们yum install  openssl-devl 也不行,这是因为centos6中yum安装的openssl版本和httpd-2.2.11所要求的版本不一致,解决办法:下载更新的 httpd(2.4.6没有问题)或者源码编译安装openssl(0.9版本)

2. 编译subversion

tar zxvf  subversion-1.5.3.tar.gz

cd subversion-1.5.3

./configure --prefix=/usr/local/subverion --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/src/httpd-2.2.11/srclib/apr/  --with-apr-util=/usr/local/src/httpd-2.2.11/srclib/apr-util --with-ssl 

make && make install 

3.  添加svn用户 

useradd SVN

4. 创建仓库

/usr/local/subverion/bin/svnadmin create /home/SVN/lishiming

5. 测试svn

添加一个文件到仓库   /usr/local/subverion/bin/svn   import    /tmp/disk.txt     file:///home/SVN/lishiming/disk.txt  -m test

其中 命令格式为 svn  import  filename svn仓库路径 -m  说明

查看添加的文件信息  /usr/local/subverion/bin/svn list --verbose file:///home/SVN/lishiming/

6. 整合apache

vim /usr/local/apache2/conf/httpd.conf

在最后面加入

<Location /lishiming>

   DAV svn

   SVNPath /home/SVN/lishiming

   AuthzSVNAccessFile /home/SVN/lishiming/conf/authz.conf

   AuthType Basic

   AuthName "Subversion"

   AuthUserFile /home/SVN/authfile

   Require valid-user

</Location>

另外需要修改一下 

User  SVN

Group  SVN

7. 添加认证用户

/usr/local/apache2/bin/htpasswd -c /home/SVN/authfile svntest  

说明:第一次创建这个用户是需要加-c 选项,以后再次创建就不需要了,因为authfile 文件已经存在

8. 编辑用户权限

vim /home/SVN/lishiming/conf/authz.conf   内容如下:

[lishiming:/]

svntest = rw 

9. 更改权限

chown -R SVN:SVN /home/SVN/

10. 重启apache

访问 10.0.2.111/lishiming/

本文转自 a928154159 51CTO博客,原文链接:http://blog.51cto.com/zhibeiwang/1787773

继续阅读