Apache+Svn設(shè)置問(wèn)題詳解
本節(jié)介紹一下SVN設(shè)置問(wèn)題,開(kāi)始是在win2003enterpriseserver下用Apache+Svn設(shè)置,希望通過(guò)本節(jié)的學(xué)習(xí)大家能夠掌握Apache+SVN設(shè)置的方法,歡迎大家一起來(lái)學(xué)習(xí)。下面是具體介紹。
1.建立SVNServe服務(wù)器
1)啟動(dòng)服務(wù)器程序svnserve
A:-r直接指定到版本庫(kù)(稱之為單庫(kù)svnserve方式)
比如,有一個(gè)庫(kù)project1,位于D:\svn\project1
svnserve-d-rD:\svn\project1
此種方式建立的版本庫(kù),訪問(wèn)方式為:
Svn://127.0.0.1/
B:-r指定到版本庫(kù)的上級(jí)目錄(稱之多庫(kù)svnserve方式)
同樣,有一個(gè)庫(kù)project1,位于D:\svn\project1
如果使用以下命令啟動(dòng)svnserve
svnserve-d-rD:\svn
此種方式建立的版本庫(kù),訪問(wèn)方式為:
Svn://127.0.0.1/project1/。我們?cè)賮?lái)看一下Apache+SVN設(shè)置過(guò)程中如何建立權(quán)限。
2.建立權(quán)限
1)svnserve.conf文件結(jié)構(gòu)分析
每個(gè)建立的版本庫(kù)下,都存在/conf/svnserve.conf文件,此文件就是用于配置此版本庫(kù)的訪問(wèn)權(quán)限。
在版本庫(kù)權(quán)限配置文件svnserve.conf中,以#開(kāi)頭的行為注釋。建立版本庫(kù)后,默認(rèn)文件內(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
此文件,大部分都以#開(kāi)頭,為注釋部分。文件真實(shí)內(nèi)容只有一句:
[general]
Apache+SVN設(shè)置在以下講解時(shí),只顯示出配置內(nèi)容,不顯示注釋。
首先來(lái)解釋以下兩句的意義:
anon-access=read
auth-access=write
anon-access表示沒(méi)有進(jìn)行驗(yàn)證的用戶的功能,有三個(gè)可選項(xiàng):none,read,write。
none表示沒(méi)有什么權(quán)限,此時(shí)客戶端連接服務(wù)器時(shí),客戶端就提示進(jìn)行驗(yàn)證用戶;
read表示有讀取本版本庫(kù)的內(nèi)容的權(quán)限,但不能進(jìn)行commit操作;
write表示可以進(jìn)行版本庫(kù)的讀寫(xiě)的權(quán)限;
auth-access表示經(jīng)過(guò)了驗(yàn)證的用戶的權(quán)限;
password-db=passwd
這個(gè)語(yǔ)句告訴svnserve.exe,用戶名與密碼放在passwd.文件中,對(duì)于passwd文件的結(jié)構(gòu)后面再做說(shuō)明authz-db=authz
告訴svnserve.exe,項(xiàng)目目錄訪問(wèn)權(quán)限的相關(guān)配置是放在authz.文件中,此文件的設(shè)置是細(xì)分權(quán)限,具體結(jié)構(gòu)下面將做說(shuō)明;
所以,對(duì)于正常使用的版本管理,一般是要進(jìn)行驗(yàn)證的,典型的/conf/svnserve.conf一般為:
[general]
anon-access=none
auth-access=write
password-db=passwd
authz-db=authz
注意:每個(gè)配置行,都要頂頭寫(xiě),沒(méi)有空格。請(qǐng)期待下節(jié)有關(guān)Apache+SVN設(shè)置講解。
【編輯推薦】