作者:sealyu
1. 簡(jiǎn)介
SubVersion 是新一代的版本控制工具,不僅可以管理程序源代碼,而且也可用于文檔或其他相關(guān)資料的管理。
2. 下載
svnsetup.exe http://subversion.tigris.org
客戶端TortoiseSVN http://tortoisesvn.net/downloads
3. 安裝步驟
1)安裝剛才下載的軟件
下面假設(shè)svnsetup的安裝目錄為
C:\Program Files\Subversion
您想建svn庫(kù)的文件夾為 E:\svn
2)創(chuàng)建庫(kù)
在E:\svn下,右鍵-》TortoiseSVN->Create Repository here.
會(huì)在此文件夾下創(chuàng)建一個(gè)版本庫(kù),生成所需的文件。
3)創(chuàng)建為Windows自動(dòng)運(yùn)行的服務(wù)
Subversion 從1.4版本開(kāi)始,可以以windows系統(tǒng)服務(wù)的形式在開(kāi)機(jī)時(shí)自動(dòng)運(yùn)行。但Subversion安裝程序還不能把自己安裝成windows服務(wù),需要我們自己進(jìn)行手動(dòng)安裝,方法如下: 打開(kāi)一個(gè)DOS命令窗口,執(zhí)行如下命令:
sc create svnserve binPath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root E:\svn" displayname= "Subversion Repository" depend= Tcpip start= auto
其中,sc是windows自帶的服務(wù)配置程序,參數(shù)binPath表示svnserve可執(zhí)行文件的安裝路徑,由于路徑中的"Program Files"帶有空格,因此整個(gè)路徑需要用雙引號(hào)引起來(lái)。而雙引號(hào)本身是個(gè)特殊字符,需要進(jìn)行轉(zhuǎn)移,因此在路徑前后的兩個(gè)雙引號(hào)都需要寫(xiě)成\"
-- service參數(shù)表示以windows服務(wù)的形式運(yùn)行,--root指明svn repository的位置,service參數(shù)與root參數(shù)都作為binPath的一部分,因此與svnserve.exe的路徑一起被包含在一對(duì)雙引號(hào)當(dāng)中,而這對(duì)雙引號(hào)不需要進(jìn)行轉(zhuǎn)義。
displayname表示在windows服務(wù)列表中顯示的名字, depend =Tcpip 表示svnserve服務(wù)的運(yùn)行需要tcpip服務(wù),start=auto表示開(kāi)機(jī)后自動(dòng)運(yùn)行。
安裝服務(wù)后,svnserve要等下次開(kāi)機(jī)時(shí)才會(huì)自動(dòng)運(yùn)行。
若要卸載svn服務(wù),則執(zhí)行 sc delete svnserve 即可。
4)配置訪問(wèn)權(quán)限
1 配置倉(cāng)庫(kù)
SVN的svnserve對(duì)于每個(gè)倉(cāng)庫(kù),有一個(gè)獨(dú)立的配置文件和獨(dú)立的用戶、權(quán)限管理。
在這里仍然要保持配置文件svnserve.conf的獨(dú)立,但是用戶、權(quán)限管理是用統(tǒng)一的一個(gè)文件來(lái)存儲(chǔ)。
這樣方便以后的管理和維護(hù)。
另外要注意,即使svnserve服務(wù)已經(jīng)運(yùn)行,修改配置文件或者用戶、權(quán)限管理文件,保存后馬上生效,不需要重啟服務(wù)。
假設(shè)已經(jīng)配置兩個(gè)倉(cāng)庫(kù): source1和source2,都在E:\svn下.
我們?cè)贓:\svn下放兩個(gè)文件:passwd.conf 和authz.conf
1.1 配置source1倉(cāng)庫(kù)
進(jìn)入倉(cāng)庫(kù)目錄
1.2 修改配置
你可以直接刪除默認(rèn)的svnserve.conf文件,然后使用下面的配置:
編輯svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ..\..\passwd
authz-db = ..\..\authz
realm = My First Repository
說(shuō)明:
anon-access = none #不允許匿名用戶訪問(wèn)
auth-access = write #通過(guò)驗(yàn)證的用戶可以讀和寫(xiě)
password-db = ..\..\passwd#用戶保存文件
authz-db = ..\..\authz#權(quán)限管理文件
realm = My First Repository #倉(cāng)庫(kù)名稱(chēng)
1.3 配置source2倉(cāng)庫(kù)
進(jìn)入倉(cāng)庫(kù)目錄
1.4 修改配置
你可以直接刪除默認(rèn)的svnserve.conf文件,然后使用下面的配置:
編輯svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ..\..\passwd
authz-db = ..\..\authz
realm = My Second Repository
如果有更多的倉(cāng)庫(kù),可以類(lèi)推配置。
----------------------------------------------------------------------
svnserve.conf的原始內(nèi)容:
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
# anon-access = read
# auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### Uncomment the line below to use the default password file.
# password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the conf
### directory. If you don't specify an authz-db, no path-based access
### control is done.
### Uncomment the line below to use the default authorization file.
# authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository
----------------------------------------------------------------------
2 用戶管理
2.1 創(chuàng)建用戶存儲(chǔ)文件
編輯passwd
2.2 設(shè)置用戶帳號(hào)
[users]
harry = harryssecret
sally = sallyssecret
bote = botessecret
說(shuō)明:
[users] #是必須的,標(biāo)記為用戶配置開(kāi)始
harry = harryssecret # harry 是用戶名 , harryssecret是密碼。注意,是明文密碼
sally = sallyssecret # 同上
bote = botessecret # 同上
往后所以倉(cāng)庫(kù)的用戶都在這里記錄就可以了。至于那個(gè)用戶,允許訪問(wèn)那個(gè)倉(cāng)庫(kù),在權(quán)限管理里限制。
3 權(quán)限管理
3. 1 創(chuàng)建權(quán)限管理文件
編輯authz.conf
3.2 設(shè)置權(quán)限管理
[groups]
source1 = harry
source2 = sally
[source1:/]
@source1 = rw
@source2 = r
[source2:/]
@source2 = rw
bote = rw
1. 簡(jiǎn)介
SubVersion 是新一代的版本控制工具,不僅可以管理程序源代碼,而且也可用于文檔或其他相關(guān)資料的管理。
2. 下載
svnsetup.exe http://subversion.tigris.org
客戶端TortoiseSVN http://tortoisesvn.net/downloads
3. 安裝步驟
1)安裝剛才下載的軟件
下面假設(shè)svnsetup的安裝目錄為
C:\Program Files\Subversion
您想建svn庫(kù)的文件夾為 E:\svn
2)創(chuàng)建庫(kù)
在E:\svn下,右鍵-》TortoiseSVN->Create Repository here.
會(huì)在此文件夾下創(chuàng)建一個(gè)版本庫(kù),生成所需的文件。
3)創(chuàng)建為Windows自動(dòng)運(yùn)行的服務(wù)
Subversion 從1.4版本開(kāi)始,可以以windows系統(tǒng)服務(wù)的形式在開(kāi)機(jī)時(shí)自動(dòng)運(yùn)行。但Subversion安裝程序還不能把自己安裝成windows服務(wù),需要我們自己進(jìn)行手動(dòng)安裝,方法如下: 打開(kāi)一個(gè)DOS命令窗口,執(zhí)行如下命令:
sc create svnserve binPath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root E:\svn" displayname= "Subversion Repository" depend= Tcpip start= auto
其中,sc是windows自帶的服務(wù)配置程序,參數(shù)binPath表示svnserve可執(zhí)行文件的安裝路徑,由于路徑中的"Program Files"帶有空格,因此整個(gè)路徑需要用雙引號(hào)引起來(lái)。而雙引號(hào)本身是個(gè)特殊字符,需要進(jìn)行轉(zhuǎn)移,因此在路徑前后的兩個(gè)雙引號(hào)都需要寫(xiě)成\"
-- service參數(shù)表示以windows服務(wù)的形式運(yùn)行,--root指明svn repository的位置,service參數(shù)與root參數(shù)都作為binPath的一部分,因此與svnserve.exe的路徑一起被包含在一對(duì)雙引號(hào)當(dāng)中,而這對(duì)雙引號(hào)不需要進(jìn)行轉(zhuǎn)義。
displayname表示在windows服務(wù)列表中顯示的名字, depend =Tcpip 表示svnserve服務(wù)的運(yùn)行需要tcpip服務(wù),start=auto表示開(kāi)機(jī)后自動(dòng)運(yùn)行。
安裝服務(wù)后,svnserve要等下次開(kāi)機(jī)時(shí)才會(huì)自動(dòng)運(yùn)行。
若要卸載svn服務(wù),則執(zhí)行 sc delete svnserve 即可。
4)配置訪問(wèn)權(quán)限
1 配置倉(cāng)庫(kù)
SVN的svnserve對(duì)于每個(gè)倉(cāng)庫(kù),有一個(gè)獨(dú)立的配置文件和獨(dú)立的用戶、權(quán)限管理。
在這里仍然要保持配置文件svnserve.conf的獨(dú)立,但是用戶、權(quán)限管理是用統(tǒng)一的一個(gè)文件來(lái)存儲(chǔ)。
這樣方便以后的管理和維護(hù)。
另外要注意,即使svnserve服務(wù)已經(jīng)運(yùn)行,修改配置文件或者用戶、權(quán)限管理文件,保存后馬上生效,不需要重啟服務(wù)。
假設(shè)已經(jīng)配置兩個(gè)倉(cāng)庫(kù): source1和source2,都在E:\svn下.
我們?cè)贓:\svn下放兩個(gè)文件:passwd.conf 和authz.conf
1.1 配置source1倉(cāng)庫(kù)
進(jìn)入倉(cāng)庫(kù)目錄
1.2 修改配置
你可以直接刪除默認(rèn)的svnserve.conf文件,然后使用下面的配置:
編輯svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ..\..\passwd
authz-db = ..\..\authz
realm = My First Repository
說(shuō)明:
anon-access = none #不允許匿名用戶訪問(wèn)
auth-access = write #通過(guò)驗(yàn)證的用戶可以讀和寫(xiě)
password-db = ..\..\passwd#用戶保存文件
authz-db = ..\..\authz#權(quán)限管理文件
realm = My First Repository #倉(cāng)庫(kù)名稱(chēng)
1.3 配置source2倉(cāng)庫(kù)
進(jìn)入倉(cāng)庫(kù)目錄
1.4 修改配置
你可以直接刪除默認(rèn)的svnserve.conf文件,然后使用下面的配置:
編輯svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ..\..\passwd
authz-db = ..\..\authz
realm = My Second Repository
如果有更多的倉(cāng)庫(kù),可以類(lèi)推配置。
----------------------------------------------------------------------
svnserve.conf的原始內(nèi)容:
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository. (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)
### Visit http://subversion.tigris.org/ for more information.
[general]
### These options control access to the repository for unauthenticated
### and authenticated users. Valid values are "write", "read",
### and "none". The sample settings below are the defaults.
# anon-access = read
# auth-access = write
### The password-db option controls the location of the password
### database file. Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### Uncomment the line below to use the default password file.
# password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the conf
### directory. If you don't specify an authz-db, no path-based access
### control is done.
### Uncomment the line below to use the default authorization file.
# authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository
----------------------------------------------------------------------
2 用戶管理
2.1 創(chuàng)建用戶存儲(chǔ)文件
編輯passwd
2.2 設(shè)置用戶帳號(hào)
[users]
harry = harryssecret
sally = sallyssecret
bote = botessecret
說(shuō)明:
[users] #是必須的,標(biāo)記為用戶配置開(kāi)始
harry = harryssecret # harry 是用戶名 , harryssecret是密碼。注意,是明文密碼
sally = sallyssecret # 同上
bote = botessecret # 同上
往后所以倉(cāng)庫(kù)的用戶都在這里記錄就可以了。至于那個(gè)用戶,允許訪問(wèn)那個(gè)倉(cāng)庫(kù),在權(quán)限管理里限制。
3 權(quán)限管理
3. 1 創(chuàng)建權(quán)限管理文件
編輯authz.conf
3.2 設(shè)置權(quán)限管理
[groups]
source1 = harry
source2 = sally
[source1:/]
@source1 = rw
@source2 = r
[source2:/]
@source2 = rw
bote = rw