RHEL6.4下搭建apache和subversion(SVN)

來源:互聯網
上載者:User

標籤:svn apache mod_dav

1、說明

rhel6.4系統下搭建apache+svn


2、實現

1)在伺服器上安裝配置SVN服務;

2)SVN服務支援svnserve獨立服務模式訪問;

3)SVN服務支援Apache的http模式訪問。


3、安裝svn伺服器

[[email protected] ~]# yum install -y subversion[[email protected] ~]# rpm -qa|grep subversionsubversion-1.6.11-15.el6_7.x86_64


4、安裝apache伺服器

[[email protected] ~]# yum install -y httpd[[email protected] ~]# rpm -qa|grep httphttpd-2.2.15-56.el6.centos.3.x86_64


5、配置SVN版本庫

[[email protected] ~]# mkdir /svn[[email protected] ~]# svnadmin create /svn/reed[[email protected] ~]# cd /svn/reed/[[email protected] reed]# lltotal 24drwxr-xr-x 2 root root 4096 Apr  6 05:09 confdrwxr-sr-x 6 root root 4096 Apr  6 05:09 db-r--r--r-- 1 root root    2 Apr  6 05:09 formatdrwxr-xr-x 2 root root 4096 Apr  6 05:09 hooksdrwxr-xr-x 2 root root 4096 Apr  6 05:09 locks-rw-r--r-- 1 root root  229 Apr  6 05:09 README.txt


6、使用者密碼passwd配置

[[email protected] reed]# cd conf/[[email protected] conf]# lltotal 12-rw-r--r-- 1 root root 1080 Apr  6 05:09 authz-rw-r--r-- 1 root root  309 Apr  6 05:09 passwd-rw-r--r-- 1 root root 2279 Apr  6 05:09 svnserve.conf[[email protected] conf]# vim passwd[[email protected] conf]# grep ‘^[^#]‘ passwd[users]admin=123reed=123deer=123


7、許可權控制authz配置

[[email protected] conf]# vim authz[[email protected] conf]# grep ‘^[^#]‘ authz[aliases][groups][/]*=radmin=rw[/public]*=rw[/reed]admin=rwreed=rw*=[/deer]admin=rwdeer=rw*=


8、服務svnserve.conf配置

[[email protected] conf]# vim svnserve.conf[[email protected] conf]# grep ‘^[^#]‘ svnserve.conf[general]anon-access = none   #禁止匿名訪問,設定為none。預設為read,參數:read,write,nonepassword-db = passwdauthz-db = authzrealm = /svn/reed    #每個SVN項目的認證名,會在認證提示裡顯示,建議寫項目名稱。[sasl][[email protected] conf]#


9、啟動SVN服務

[[email protected] conf]# svnserve -d -r /svn


10、使用checkout匯出檔案

[[email protected] deer]# svn co svn://127.0.0.1/reedAuthentication realm: <svn://127.0.0.1:3690> /svn/reedPassword for ‘root‘:Authentication realm: <svn://127.0.0.1:3690> /svn/reedUsername: deerPassword for ‘deer‘:-----------------------------------------------------------------------ATTENTION!  Your password for authentication realm:<svn://127.0.0.1:3690> /svn/reedcan only be stored to disk unencrypted!  You are advised to configureyour system so that Subversion can store passwords encrypted, ifpossible.  See the documentation for details.You can avoid future appearances of this warning by setting the valueof the ‘store-plaintext-passwords‘ option to either ‘yes‘ or ‘no‘ in‘/root/.subversion/servers‘.-----------------------------------------------------------------------Store password unencrypted (yes/no)? yesA    reed/deerA    reed/publicChecked out revision 1.[[email protected] reed]# lsdeer  public[[email protected] reed]# svn up .A    public/restartsvn.shUpdated to revision 2.[[email protected] reed]#


11、配置svn支援http訪問

通過 Http 協議訪問版本庫是 Subversion 的亮點之一。使用 Http 協議意味著只需要開啟瀏覽器,輸入 URL 即可輕鬆的瀏覽整個版本庫。靈活通常帶來複雜性,Http 方式相對於 svnserve 方式來說需要更多的配置。

由於 Subversion 需要版本化的控制,因此標準的 Http 協議不能滿足需求。要讓 Apache 與 Subversion 協同工作,需要使用 WebDAV(Web 分布式創作和版本控制)。WebDAV 是 HTTP 1.1 的擴充,關於 WebDAV 的規範和工作原理,可以參考 IETF RFC 2518。

為了使 Subversion 與 dav 模組通訊,需要安裝 mod_dav_svn 外掛程式。

11.1、安裝mod_dav_svn

[[email protected] conf]# yum install mod_dav_svn

11.2、配置subversion.conf

[[email protected] conf.d]# grep ‘^[^#]‘ subversion.confLoadModule dav_svn_module     modules/mod_dav_svn.soLoadModule authz_svn_module   modules/mod_authz_svn.so<Location /reed>DAV svnSVNPath /svn/reedAuthType Basic   # 使用基本認證方式,即使用者名稱、密碼認證 AuthName "svn reed"   # 在認證對話方塊中出現的提示資訊  AuthUserFile /svn/reed/svnuser  # 指定http存放使用者名稱資訊的檔案路徑 AuthzSVNAccessFile /svn/reed/conf/authz #AuthzSVNAccessFile 指向的是 authz 的策略檔案Satisfy AnyRequire valid-user # 限定只有使用者輸入正確的使用者名稱和密碼後才能訪問該標籤所指向的路徑  </Location>

11.3、建立帳號密碼認證檔案

/svn/reed/conf/authz檔案是svnserve獨立伺服器使用的認證檔案,密碼沒有加密,明文顯示。

/svn/reed/svnuser檔案是Apache的http模式使用的認證檔案,密碼使用MD5加密。

authz和svnuser檔案中,帳號密碼必須設定相同。

[[email protected] conf.d]# htpasswd -c  /svn/reed/svnuser adminNew password:Re-type new password:Adding password for user admin[[email protected] conf.d]# htpasswd   /svn/reed/svnuser reedNew password:Re-type new password:Adding password for user reed[[email protected] conf.d]# htpasswd   /svn/reed/svnuser deerNew password:Re-type new password:Adding password for user deer

12、啟動httpd服務

[[email protected] conf.d]# /etc/init.d/httpd startStarting httpd: httpd: apr_sockaddr_info_get() failed for reedoraclehttpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName[  OK  ]

13、測試

13.1、通過用戶端訪問

13.2、通過瀏覽器訪問




本文出自 “[[email protected]盧偉開~]#rm -rf /” 部落格,請務必保留此出處http://luweikai.blog.51cto.com/1705672/1913530

RHEL6.4下搭建apache和subversion(SVN)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.