CentOS7搭建svn服务器( 二 )


验证中 : apr-1.4.8-7.el7.x86_64 2/4
验证中 :
subversion-1.7.14-16.el7.x86_64 3/4
验证中 :
apr-util-1.5.2-6.el7.x86_64 4/4
已安装:
subversion.x86_64 0:1.7.14-16.el7
作为依赖被安装:
apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 subversion-libs.x86_64 0:1.7.14-16.el7
完毕!
 
2,创建svn版本库
 
1)创建仓库文件夹,命令如下:
 

[root@localhost opt]# mkdir -p /opt/svn/repository
 
2)创建svn版本库,命令如下:
 
[root@localhost opt]# svnadmin create /opt/svn/repository
 
创建成功,进入/opt/svn/repository文件夹,信息如下:
 
[root@localhost opt]# cd /opt/svn/repository/
[root@localhost repository]# ll
总用量 8
drwxr-xr-x. 2 root root 54 6月 6 17:52 conf
drwxr-sr-x. 6 root root 233 6月 6 17:52 db
-r--r--r--. 1 root root 2 6月 6 17:52 format
drwxr-xr-x. 2 root root 231 6月 6 17:52 hooks
drwxr-xr-x. 2 root root 41 6月 6 17:52 locks
-rw-r--r--. 1 root root 229 6月 6 17:52 README.txt
 
3,权限配置
 
进入/opt/svn/repository/conf目录,有如下三个文件:
 
[root@localhost conf]# ll
总用量 12
-rw-r--r--. 1 root root 1080 6月 6 17:52 authz
-rw-r--r--. 1 root root 309 6月 6 17:52 passwd
-rw-r--r--. 1 root root 3090 6月 6 17:52 svnserve.conf
 
文件说明:
authz:负责账号权限的管理,控制账号是否读写权限
passwd:负责账号和密码的用户名单管理
svnserve.conf:svn服务器配置文件
 
1)authz配置
 
执行vim authz,配置关键信息如下:
 
[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,&joeadmin=admindev=zhangsan,lisi,wangwu# [/foo/bar]# harry = rw# &joe = r# * =# [repository:/baz/fuz]# @harry_and_sally = rw# * = r#[/]表示根目录,即/opt/svn/repository/[/]#@加组名称,给该组赋权,r表示读,w表示写@admin=rw#[/dev]实际上为/opt/svn/repository/dev[/dev]@dev=rw 
CentOS7搭建svn服务器

文章插图
 
2)配置passwd
 
执行 vim passwd,配置svn访问用户和密码:
 
### 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# 等号前面为用户名,后面为登录密码admin = admin@123zhangsan = zhang@123lisi = li@123wangwu = wang@123 
CentOS7搭建svn服务器

文章插图
 
3)配置 svnserve.conf
 
执行vim svnserve.conf,配置访问权限,关键信息如下:
 
### users have read-only access to the repository, while authenticated### users have read and write access to the repository.anon-access = noneauth-access = write### users have read and write access to the repository.anon-access = noneauth-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 = /opt/svn/repository 
CentOS7搭建svn服务器

文章插图
 
配置说明:
 
anon-access = none:表示禁止匿名用户访问
auth-access = write:表示授权用户拥有读写权限


推荐阅读