天天看點

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

繼續閱讀