天天看點

windows下用WANdisco搭建svn伺服器

一:安裝

(1)進入http://subversion.apache.org/點選Binary Packages

選擇windows下WANdisco後,點選下載下傳版本後進入下載下傳頁面

windows下用WANdisco搭建svn伺服器

根據提示填寫資訊(ps:郵箱一定要填寫一個可用的),送出之後會發一封郵件到你的郵箱,檔案中有下載下傳位址,點選下載下傳即可

(2)正式安裝

windows下用WANdisco搭建svn伺服器

其中Password File可以先不填(因為咱也沒有),Repository Directory選個檔案夾作為版本庫,填完之後Install,,基本安裝完成

二:版本庫建立及配置

(1)建立版本庫(對應的當然是之前填寫的Repository Diretory)

安裝的時候選了版本庫檔案夾,但這個檔案夾并不是真正的版本庫,是以我們來建立一下

在cmd指令框中輸入svnadmin create G:\svn\repository

windows下用WANdisco搭建svn伺服器

(2)建立密碼檔案(此檔案也就是Password File)

在cmd指令框中輸入htpasswd -c filename username

ps:檔案在目前指令的位置輸出,比如你在d:打的指令,那麼檔案就在d盤下;filename是輸出檔案的檔案名,username為使用者名

輸入兩次密碼之後,檔案建立成功(密碼為123456,這為加密之後的)

windows下用WANdisco搭建svn伺服器

(3)在建立好的版本庫中修改配置參數(路徑G:\svn\repository\conf\svnserve.conf)

auth-access = write   
  
password-db = passwd   
  
authz-db = authz   
  
realm = myproject
           

auth-access = write #允許寫入

password-db = passwd #通路時需要輸入密碼

auth-db = authz #通路權限設定

realm = myproject #版本庫辨別符(在權限配置檔案中會用到)

(4)配置版本庫權限控制檔案(路徑G:\svn\repository\conf\authz)

[groups]   
admin =  harry,sally,lisq  
  
[/]   
@admin = rw   
  
[myproject:/]   
@admin = rw 
           

[groups] #配置使用者組

格式為:  使用者組名 = 使用者名1,使用者名2,使用者名3

[/] #根目錄及以下

格式為:@使用者組名 = 權限

[myproject:/] #版本庫權限(myproject就是之前在svnserve.conf中配置的版本庫辨別符)

格式為:@使用者組名 = 權限

w:寫權限    r:讀權限

三:配置Subversion(之前儲存的路徑是D:\Subversion)

找到配置檔案(D:\Subversion\Apache2\conf\subversion.conf)

<VirtualHost *:8888>
 KeepAlive On
 <Location /svn>
  DAV svn
  SVNParentPath G:\svn
  # SVNParentPath and authz fix http://subversion.tigris.org/issues/show_bug.cgi?id=2753
  RedirectMatch ^(/svn)$ $1/ 
  AuthType Basic
  AuthName "Subversion Repo"
  # If you didn't specify a password file during installation the
  # next line needs to be configured for user authentication.
  AuthUserFile "G:\passwd"
  AuthzSVNAccessFile "G:\svn\repository\conf\authz"
  Require valid-user
  Order allow,deny
  Allow from all
  SVNAutoversioning on
 </Location>
 # Enable Subversion logging 
CustomLog logs/subversion.log combined
</VirtualHost>
           

AuthUserFile:密碼檔案的路徑(之前建立的那個密碼檔案路徑)

AuthzSVNAccessFile:權限控制檔案的路徑(之前版本庫下配置好的authz檔案路徑)

至此,所有工作全部完成,啟動svn伺服器,連接配接測試下

windows下用WANdisco搭建svn伺服器
windows下用WANdisco搭建svn伺服器

繼續閱讀