Linux上svn服务器的搭建
安装svn服务器
直接用yum安装,命令如下:
#yum install -y subversion
验证是否安装成功。
#svnserve --version
创建SVN版本库
在home目录下创建svn目录
#mkdir /home/svn
创建项目目录,如project1
#svnadmin create /home/svn/project1
配置SVN
进入目录/home/svn/project1/conf,有三个文件
authz passwd svnserve.conf
(1)svnserve.conf: svn服务配置文件。
(2)passwd: 用户名口令文件。
(3)authz: 权限配置文件。
passwd文件
此文件用来指定用户名密码
#cat 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
zhao = zhao
等号左边是用户名,右边是密码。注意等号两边有空格。
svnserve.conf 文件
该文件配置项分为以下5项:
anon-access: 控制非鉴权用户访问版本库的权限。
auth-access: 控制鉴权用户访问版本库的权限。
password-db: 指定用户名口令文件名。
authz-db:指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制。
realm:指定版本库的认证域,即在登录时提示的认证域名称。若两个版本库的认证域相同,建议使用相同的用户名口令数据文件
其配置如下:
### 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 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
[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
authz文件
可以设置别名[aliases]、组[groups]和权限
### 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
dev = zhao,harry
# [/foo/bar]
# harry = rw
# &joe = r
# * =
[/repository:/svn/project1]
zhao = rw
@dev = rw
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
别名的我还没研究明白。
组的权限用@表示。
如果别人都没有权限,用* = 表示。
启动和停止SVN
启动SVN
#svnserve -d -r /home/svn
停止SVN
#ps -aux|grep svn
#kill -9 id