apache + subversion for linux 安裝

來源:互聯網
上載者:User

SVN是管理工程本版的必備工具,相對vss以及其前身cvs來說都有著無與倫比的優勢

以下是apache+subversion服務端安裝步驟:

一、準備好安裝包:

①apr-1.3.6.tar.gz   :http://apr.apache.org/

②apr-util-1.3.8.tar.gz

③subversion-1.6.3.tar.gz  : http://subversion.tigris.org/

④subversion-deps-1.6.3.tar.gz

⑤httpd-2.2.9.tar.gz :http://httpd.apache.org/

注意:apach的版本 與 subversion版本的相容問題,官網都有介紹的

二、開始安裝:把以上安裝包上傳至/usr/local目錄,cd /usr/local 進入該目錄

1、安裝apr

      tar zxvf  apr-1.3.6.tar.gz #解壓包

      cd apr-1.3.6

      ./configure

      make

      make install

2、安裝apr-util

      tar zxvf apr-util-1.3.8.tar.gz

      cd apr-util-1.3.8

      ./configure --with-apr=/usr/local/apr

      make

      make install

3、安裝 apache

      tar zxvf  httpd-2.2.9.tar.gz

      cd httpd-2.2.9

      ./configure --prefix=/usr/local/apache2.2.9 --enable-dav --enable-so --enable-maintainer-mode --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config  #--prefix表示把apache安裝在指定目錄

      make

      make install

4、安裝subversion

      tar zxvf  subversion-1.6.3.tar.gz 

      tar zxvf  subversion-deps-1.6.3.tar.gz

      cd subversion-1.6.3

      ./configure --prefix=/opt/svn --with-apxs=/usr/local/apache2.2.9/bin/apxs --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr

      make

      make install

      至此,安裝基本完畢,再配置下就可以使用了

 

      注意:因為這些安裝包需要gcc編譯,所以要確保linux上裝有gcc程式,否則是沒辦法進行安裝的

 

 三、在apache中配置SVN

      vi /usr/local/apache2.2.9/conf/httpd.conf

     ① 如果你看到如下兩句,說明安裝是成功的

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

      如果有下面一句就用#注釋掉

      #LoadModule foo_module modules/mod_foo.so

      
     ② 定義apache訪問svn配置:
      <Location /svn>
              DAV  svn
      #      SVNPath /opt/svndata
              SVNParentPath /opt/svndata
              AuthzSVNAccessFile /opt/svn/conf/authz.conf
              AuthType Basic
              AuthName "Subversion repository"
              AuthUserFile /opt/svn/conf/passwd.conf
              Require valid-user
      </Location>

 四、配置svn

      ①建立svn版本庫目錄

      mkdir -p /opt/svndata/repos #可以多建版本庫目錄

      ②建立svn版本庫

      svnadmin create /opt/svndata/repos

      mkdir -p /opt/svndata/repos #可以多建版本庫

      ③建立本地存取控制檔案

      /usr/local/apache2.2.9/bin/htpasswd -c /opt/svn/conf/passwd.conf  username

      然後輸入密碼即可,預設是MD5加密的

      /usr/local/apache2.2.9/bin/htpasswd  /opt/svn/conf/passwd.conf  username1 #追加使用者

      ④建立本地項目控制檔案

      touch /opt/svn/conf/authz.conf
      

      本例authz.conf內容為:

      

      [groups]
      #<groupname1>=<username1>,<username2>
      admin=username

      #[<versionLib>:projectName/directory]
      #@<groupsname>=<authorities>
      #<username>=<authorities>

      [/]
      @admin = rw      #指定使用者群組成員可以讀寫根目錄所有應用

      [repos:/abc/aaa]
      username1= rw      #指定使用者username1可以讀寫:/abc/aaa目錄的檔案

至此,整個安裝過程完成了!

五、測試連接

     ① 啟動apache

      /usr/local/apache2.2.9/bin/apachectl start

     ② 開啟瀏覽器,輸入http://192.168.1.107/svn/repos #本例伺服器ip是192.168.1.107

      使用剛才建立的許可權使用者名稱與密碼登入即可訪問

      注意:在你上傳檔案的時候可能會有如下許可權不足的提示

      Permission denied
      svn: Commit failed (details follow):
      svn: Can't create directory '/opt/svndata/repos/db/transactions/0-1.txn': Permission denied

      這是因為apache線上程使用者沒有許可權訪問svn的倉庫,兩者分別屬於不同的使用者者

      本例apache屬於daemon擁有者,而svn倉庫屬於svn擁有者

      解決方案:

      chown -R daemon /opt/svndata/repos

      chmod -R 755 /opt/svndata/repos

    

       重啟下apache:

       /usr/local/apache2.2.9/bin/apachectl stop

       /usr/local/apache2.2.9/bin/apachectl start

      

本例是通過Eclipse的svn外掛程式用戶端測試的,上傳下載完全正常!伺服器系統是 linux Fedora 7。

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.