CentOS下SVN服务器的搭建使用
1
2
|
mkdir /svn/project // 创建版本库所在文件夹 svnadmin
create--fs- type fsfs /svn/project/first // 创建版本库,如果需要使用bdb方式存储,则将fsfs改成bdb即可 |
1
2
|
svn import /home/software
file: ///svn/project/first--message
"初始化版本" //将home文件夹的文件导入版本库 svn
list --verbose file: ///svn/project/first
//查看导入的文件 |
1
|
svnserve
-d -r /svn/project/first |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
###
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 sectionname. ###
The authorizations follow. An authorization line can refer to: ###
- a single user, ###
- a groupof 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 rulewith'~'. Rules can ###
grantread ('r') access, read-write ('rw') access, orno 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 admin=first,second,third // 用户组admin包含的成员 user=anyone // 用户组user包含的成员 #
[/foo/bar] #
harry = rw #
&joe = r #
* = #
[repository:/baz/fuz] #
@harry_and_sally = rw #
* = r [/] @admin=rw // 用户组admin内成员拥有读写权限 @user=r // 用户组user内成员拥有读权限 |
1
2
3
4
5
6
7
8
9
10
11
|
###
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 nameandpasswordfor each user follow, one account per line. [ users ] #
harry = harryssecret #
sally = sallyssecret first=first second=second third=third anyone=anyone |
1
2
3
4
|
anon-access
= none // 不允许匿名用户读写 auth-access
= write password-db
= passwd //svn 读取的 passwd 文件 authz-db
= authz //svn 读取的权限控制文件 |
1
2
|
yum install mod_dav_svn // 使subversion与dav模块通信的功能 yum install mod_authz_svn // 实现权限控制功能 |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
Loaded
Modules: core_module
(static) mpm_prefork_module
(static) http_module
(static) so_module
(static) auth_basic_module
(shared) auth_digest_module
(shared) authn_file_module
(shared) authn_alias_module
(shared) authn_anon_module
(shared) authn_dbm_module
(shared) authn_default_module
(shared) authz_host_module
(shared) authz_user_module
(shared) authz_owner_module
(shared) authz_groupfile_module
(shared) authz_dbm_module
(shared) authz_default_module
(shared) ldap_module
(shared) authnz_ldap_module
(shared) include_module
(shared) log_config_module
(shared) logio_module
(shared) env_module
(shared) ext_filter_module
(shared) mime_magic_module
(shared) expires_module
(shared) deflate_module
(shared) headers_module
(shared) usertrack_module
(shared) setenvif_module
(shared) mime_module
(shared) dav_module
(shared) status_module
(shared) autoindex_module
(shared) info_module
(shared) dav_fs_module
(shared) vhost_alias_module
(shared) negotiation_module
(shared) dir_module
(shared) actions_module
(shared) speling_module
(shared) userdir_module
(shared) alias_module
(shared) substitute_module
(shared) rewrite_module
(shared) proxy_module
(shared) proxy_balancer_module
(shared) proxy_ftp_module
(shared) proxy_http_module
(shared) proxy_ajp_module
(shared) proxy_connect_module
(shared) cache_module
(shared) suexec_module
(shared) disk_cache_module
(shared) cgi_module
(shared) version_module
(shared) authz_ldap_module
(shared) dav_svn_module
(shared) authz_svn_module
(shared) Syntax
OK |
1
2
3
4
5
6
7
8
|
<Location /svn > DAV
svn SVNPath /svn/project/first AuthzSVNAccessFile /etc/httpd/conf .d /authz //apache 服务器读取的权限策略文件 AuthType
Basic AuthName "Project" AuthUserFile /etc/httpd/conf .d /passwd //apache 服务器读取的密码存储文件 Require
valid-user |
1
|
htpasswd
-c /svn/project/first admin // 命令为htpasswd,-c为参数, /svn/project/first 为访问的版本库,admin为用户名 |
1
2
3
|
[/] @admin=rw @user=r |
1
2
3
4
5
6
|
[first:/] @admin=rw @user=r [second:/] @admin=rw @user=r |