[转载]centos安装svn服务器

一、安装Subversion

#yum install subversion
 
1.查看安装时的文件产生情况,使用 rpm -ql subversion
2.卸载subversion:#yum remove subversion
3.停止subversion服务:#killall svnserve
 
二、创建仓库(以创建多个仓库为例)
#svnadmin create /var/svn/demo
#svnadmin create /var/svn/coffeetest
/var/svn/demo和/var/svn/coffeetest为所创建仓库的路径,理论上可以是任何目录。这里我取/var/svn为所有仓库的总路径,在目录下面分别创建仓库。
 
三、配置仓库
针对每个仓库单独配置,分别修改每个仓库conf目录下面的三个配置文件(authz、passwd、svnserve.conf)
 
1.修改authz文件,这个配置文件里面可以设置用户组和用户目录权限
==============================
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = admin,user1,user2
 
# [/foo/bar]
# harry = rw
# &joe = r
# * =
 
[/]
@admin = rw
*      =
==============================
上面绿色部分是我配置的内容,第一行绿色的是配置一个用户组admin 有成员admin和novalue两个;第二行绿色的开始配置目录权限,设置admin组(前面加@符号)的权限为读写权限,其他成员没有权限(* = )
 
2.修改passwd文件,设置访问当前仓库的用户和密码
===========================================
[users]
# harry = harryssecret
# sally = sallyssecret
admin  = 123456
user1  = 123456
user2  = 123456
===========================================
 
3.修改svnserve.conf文件,开启权限控制等功能
找到第一个常规选项[general],把前面是一个#号的去掉#号,如下是我的demo仓库配置内容
===========================================================================
[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 = 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
### 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 = coffeetest svndata
==========================================================================
注意:所有的行都必须顶格,否则报错。
 
四、启动和关闭服务
1.启动服务
#svnserve -d -r /var/svn --listen-host 192.168.1.16
 
命令中/var/svn是我所有仓库的所在的根目录,如果单个仓库,可以直接写仓库地址即可,比如启动demo仓库,#svnserve -d -r /var/svn/demo --listen-host 192.168.1.16
 
2.停止服务
#killall svnserve
 
五、访问仓库项目
我们有两个代码仓库/var/svn/demo 和/var/svn/test,那么在客户端访问时可以用
svn://192.168.1.16/demo
上一篇:java集合的contains(obj)方法的实现


下一篇:手写SpringMVC框架(三)-------具体方法的实现