RHEL6.2,在安装系统的时候默认安装所有的服务,因此包含svnserve在内,相当于本人的系统已默认安装svnserve,
1)查看svnserve版本,
[root@localhost vsftpd-2.0.5]# svnserve --version
svnserve,版本 1.6.11 (r934486)
编译于 May 31 2011,05:46:33
2)建立repository(仓库路径定为/root/svndata/repos,在repos路径下有conf配置文件夹)
[root@localhost vsftpd-2.0.5]# mkdir -p /root/svndata/repos
[root@localhost vsftpd-2.0.5]# svnadmin create /root/svndata/repos/
[root@localhost vsftpd-2.0.5]# svnserve -d -r /root/svndata/ (证明svnserve已经能正常启动了,下面进行细化配置)
3)在新建立repository的conf路径下进行配置用户-密码和权限
3.1)svnserve.conf
### 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 anon-access = none 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 password-db = /root/svndata/repos/conf/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 authz-db = /root/svndata/repos/conf/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 realm = /root/svndata/repos [sasl] ### This option specifies whether you want to use the Cyrus SASL ### library for authentication. Default is false. ### This section will be ignored if svnserve is not built with Cyrus ### SASL support; to check, run 'svnserve --version' and look for a line ### reading 'Cyrus SASL authentication is available.' # use-sasl = true ### These options specify the desired strength of the security layer ### that you want SASL to provide. 0 means no encryption, 1 means ### integrity-checking only, values larger than 1 are correlated ### to the effective key length for encryption (e.g. 128 means 128-bit ### encryption). The values below are the defaults. # min-encryption = 0 # max-encryption = 256
注明:anon-access = none #匿名用户无权访问 auth-access = write #授权用户可读写
3.2)passwd
### This file is an example password file for svnserve. ### Its format is similar to that of svnserve.conf. As shown in the ### example below it contains one section labelled [users]. ### The name and password for each user follow, one account per line. [users] # harry = harryssecret # sally = sallyssecret ayu = ayu liyang = liyang test = test
简单注明下,配置用户/密码,格式就是:用户 = 密码
3.3)authz
### This file is an example authorization file for svnserve. ### Its format is identical to that of mod_authz_svn authorization ### files. ### As shown below each section defines authorizations for the path and ### (optional) repository specified by the section name. ### The authorizations follow. An authorization line can refer to: ### - a single user, ### - a group of users defined in a special [groups] section, ### - an alias defined in a special [aliases] section, ### - all authenticated users, using the '$authenticated' token, ### - only anonymous users, using the '$anonymous' token, ### - anyone, using the '*' wildcard. ### ### A match can be inverted by prefixing the rule with '~'. Rules can ### grant read ('r') access, read-write ('rw') access, or no access ### (''). [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average [groups] # harry_and_sally = harry,sally # harry_sally_and_joe = harry,sally,&joe projectmanager = ayu,liyang projecttest = test # [/foo/bar] # harry = rw # &joe = r # * = # [repository:/baz/fuz] # @harry_and_sally = rw # * = r [repos:/] @projectmanager = rw * = [repos:/baz] @projectmanager = rw @projecttest = r * =
简单注明下,svnserve的权限是以“组”为划分的,这里projectmanager这个组,组员有ayu和liyang,这个组对于[repos:/]也就是对于/root/svndata/repos这个仓库和[repos:/baz]也就是对于/root/svndata/repos/baz文件夹具有rw(可读可写)权限,而projecttest这个组,组员只有test,只有[repos:/baz]的r权限(只读不写),另外,projectmanager组对于[repos:/]以及[repos:/]之下的所有子目录都是有rw权限的
4)重新启动svnserve
[root@localhost vsftpd-2.0.5]# ps -ef|grep svnserve
root 18452 1 0 07:58 ? 00:00:06 gedit /root/svndata/repos/conf/svnserve.conf
root 18645 1 0 08:15 ? 00:00:00 svnserve -d -r /root/svndata/
root 18727 3637 0 08:22 pts/0 00:00:00 grep svnserve
[root@localhost vsftpd-2.0.5]# kill -9 18645
[root@localhost vsftpd-2.0.5]# ps -ef|grep svnserve
root 18452 1 0 07:58 ? 00:00:09 gedit /root/svndata/repos/conf/svnserve.conf
root 18874 3637 0 08:39 pts/0 00:00:00 grep svnserve
[root@localhost vsftpd-2.0.5]# svnserve -d -r /root/svndata/
注:svn默认端口是3690,如果想换端口号可以svnserve -d --listen-port 3691 -r /root/svndata/
5)测试策略配置(ayu和liyang都具rw的权限,但是test只具有r的权限)
在桌面上建立一个文件夹svnrepo,
右键TortoiseSVN->Repo-browser->输入svn://192.168.1.110/repos->账户名/密码先用ayu/ayu,
然后测试baz文件夹内可以正常Add->Commit,Update->Commit。
切换用户,用test/test登录,
可以发现test用户只能check-for-update,而Commit操作的时候会报错(认证失败)。
6)svn规范化管理,参考http://www.360doc.com/content/12/0222/13/5236655_188606356.shtml
任何时候Trunk里包含的都是最新的开发代码。
当trunk达到准备发布的阶段时(或者你想冻结新特色的添加时),你应该创建一个release branches。 Release branches只是你当前trunk的一个副本。
有时你想将某个新技术引进项目。实验分支命名遵循在面原则:为其名字加上前缀“TRY-”。