Apache+Svn設置問題詳解
本節(jié)介紹一下SVN設置問題,開始是在win2003enterpriseserver下用Apache+Svn設置,希望通過本節(jié)的學習大家能夠掌握Apache+SVN設置的方法,歡迎大家一起來學習。下面是具體介紹。
1.建立SVNServe服務器
1)啟動服務器程序svnserve
A:-r直接指定到版本庫(稱之為單庫svnserve方式)
比如,有一個庫project1,位于D:\svn\project1
svnserve-d-rD:\svn\project1
此種方式建立的版本庫,訪問方式為:
Svn://127.0.0.1/
B:-r指定到版本庫的上級目錄(稱之多庫svnserve方式)
同樣,有一個庫project1,位于D:\svn\project1
如果使用以下命令啟動svnserve
svnserve-d-rD:\svn
此種方式建立的版本庫,訪問方式為:
Svn://127.0.0.1/project1/。我們再來看一下Apache+SVN設置過程中如何建立權限。
2.建立權限
1)svnserve.conf文件結構分析
每個建立的版本庫下,都存在/conf/svnserve.conf文件,此文件就是用于配置此版本庫的訪問權限。
在版本庫權限配置文件svnserve.conf中,以#開頭的行為注釋。建立版本庫后,默認文件內(nèi)容為:
- ###Thisfilecontrolstheconfigurationofthesvnservedaemon,ifyou
- ###useittoallowaccesstothisrepository.(Ifyouonlyallow###accessthroughhttp:and/orfile:URLs,thenthisfileis###irrelevant.)
- ###Visithttp://subversion.tigris.org/formoreinformation.
- [general]
- ###Theseoptionscontrolaccesstotherepositoryforunauthenticated
- ###andauthenticatedusers.Validvaluesare"write","read",
- ###and"none".Thesamplesettingsbelowarethedefaults.
- #anon-access=read
- #auth-access=write
- ###Thepassword-dboptioncontrolsthelocationofthepassword
- ###databasefile.Unlessyouspecifyapathstartingwitha/,
- ###thefile'slocationisrelativetotheconfdirectory.
- ###Uncommentthelinebelowtousethedefaultpasswordfile.
- #password-db=passwd
- ###Theauthz-dboptioncontrolsthelocationoftheauthorization
- ###rulesforpath-basedaccesscontrol.Unlessyouspecifyapath
- ###startingwitha/,thefile'slocationisrelativetotheconf
- ###directory.Ifyoudon'tspecifyanauthz-db,nopath-basedaccess
- ###controlisdone.
- ###Uncommentthelinebelowtousethedefaultauthorizationfile.
- #authzauthz-db=authz
- ###Thisoptionspecifiestheauthenticationrealmoftherepository.
- ###Iftworepositorieshavethesameauthenticationrealm,theyshould
- ###havethesamepassworddatabase,andviceversa.Thedefaultrealm
- ###isrepository'suuid.
- #realm=MyFirstRepository
此文件,大部分都以#開頭,為注釋部分。文件真實內(nèi)容只有一句:
[general]
Apache+SVN設置在以下講解時,只顯示出配置內(nèi)容,不顯示注釋。
首先來解釋以下兩句的意義:
anon-access=read
auth-access=write
anon-access表示沒有進行驗證的用戶的功能,有三個可選項:none,read,write。
none表示沒有什么權限,此時客戶端連接服務器時,客戶端就提示進行驗證用戶;
read表示有讀取本版本庫的內(nèi)容的權限,但不能進行commit操作;
write表示可以進行版本庫的讀寫的權限;
auth-access表示經(jīng)過了驗證的用戶的權限;
password-db=passwd
這個語句告訴svnserve.exe,用戶名與密碼放在passwd.文件中,對于passwd文件的結構后面再做說明authz-db=authz
告訴svnserve.exe,項目目錄訪問權限的相關配置是放在authz.文件中,此文件的設置是細分權限,具體結構下面將做說明;
所以,對于正常使用的版本管理,一般是要進行驗證的,典型的/conf/svnserve.conf一般為:
[general]
anon-access=none
auth-access=write
password-db=passwd
authz-db=authz
注意:每個配置行,都要頂頭寫,沒有空格。請期待下節(jié)有關Apache+SVN設置講解。
【編輯推薦】