Linux系統下部署SVN
1、安裝
yum -y install subversion
2、創建版本庫的上級目錄
mkdir /var/svn/svnrepos
3、創建版本庫app
svnadmin create /var/svn/svnrepos/app
注:可在svnrepos目錄下創建多個版本庫
每個版本庫有如下文件:
conf db format hooks locks README.txt
4、配置文件修改
svnserve.conf:svn服務器配置文件
authz:負責賬號權限的管理,控制賬號是否讀寫權限
passwd:負責賬號和密碼的用戶名單管理
1)svnserve.conf文件配置
[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 directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### 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 the
### directory containing this file. 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
默認不改變,則沒有賬號密碼控制、沒有權限控制,所有人可讀可寫
如下配置:
anon-access = none 匿名登錄不予許---> 用戶必須登錄
auth-access = write 登錄的用戶擁有可讀可寫權限
password-db = passwd 維護用戶登錄的賬號和密碼
authz-db = authz 維護用戶的權限
realm = My First Repository 領域值
a)配置:anon-access = none 匿名登錄不予許---> 用戶必須登錄
auth-access = write 登錄的用戶擁有可讀可寫權限
如果anon-access = none ,而沒有打開password-db=passwd,則會出現不允許訪問版本庫:
配置:anon-access = none 匿名登錄不予許---> 用戶必須登錄
auth-access = write 登錄的用戶擁有可讀可寫權限
password-db = passwd 維護用戶登錄的賬號和密碼
如果passwd中沒有配置賬號和密碼,則也不能訪問。
因此,必須正確配置賬號和密碼。【當然訪問時候必須輸入配置了的賬號和密碼,否則,驗證不通過】
b)配置:anon-access = none 匿名登錄不予許---> 用戶必須登錄
auth-access = write 登錄的用戶擁有可讀可寫權限
password-db = passwd 維護用戶登錄的賬號和密碼
authz-db = authz 維護用戶的權限
如果打開了authz-db = auth,但是authz中未配置登錄用戶的權限,則會出現認證錯誤:
因此,必須在權限文件authz中為用戶配置正確的權限。
5、啟動SVN和訪問
svnserve -d -r /var/svn/svnrepos
啟動時候可以指定目錄是所有版本庫的,也可以指定到某一個版本庫。兩種情況下,authz的權限配置會不一樣。
6、訪問svn版本庫
小烏龜訪問svn://ip:3690/app 【SVN啟動默認的端口為3690,app為版本庫】