君子以厚德载物
有朋自远方来,不宜乐乎。

二.  SVN 服务器搭建

 

2.1 使用yum 安装SVN包

 

关于YUM 服务器的配置参考:

Linux 搭建 YUM 服务器

http://blog.csdn.net/tianlesoftware/archive/2011/01/03/6113902.aspx

 

[root@singledb ~]# yum install -y subversion

Loaded plugins: rhnplugin, security

This system is not registered with RHN.

RHN support will be disabled.

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package subversion.i386 0:1.4.2-4.el5_3.1 set to be updated

--> Finished Dependency Resolution

 

Dependencies Resolved

 

====================================================================================================

 Package                Arch             Version                        Repository             Size

====================================================================================================

Installing:

 subversion             i386             1.4.2-4.el5_3.1                rhel-base             2.3 M

 

Transaction Summary

====================================================================================================

Install      1 Package(s)        

Update       0 Package(s)        

Remove       0 Package(s)        

 

Total download size: 2.3 M

Downloading Packages:

subversion-1.4.2-4.el5_3.1.i386.rpm                                          | 2.3 MB     00:00    

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing     : subversion                                                                   1/1

 

Installed:

  subversion.i386 0:1.4.2-4.el5_3.1                                                                

 

Complete!

[root@singledb ~]#

 

验证安装版本:

[root@singledb ~]# svnserve --version

svnserve, version 1.4.2 (r22196)

   compiled Aug  5 2009, 19:03:56

 

Copyright (C) 2000-2006 CollabNet.

Subversion is open source software, see http://subversion.tigris.org/

This product includes software developed by CollabNet (http://www.Collab.Net/).

 

The following repository back-end (FS) modules are available:

 

* fs_base : Module for working with a Berkeley DB repository.

* fs_fs : Module for working with a plain file (FSFS) repository.

 

2.2 创建SVN 版本库

[root@singledb ~]# mkdir /u02/svn

[root@singledb ~]# svnadmin create /u02/svn/davesvn  --davesvn为版本库名称

 

 

2.3  SVN 配置

 

创建版本库后,在这个目录下会生成3个配置文件:

[root@singledb conf]# pwd

/u02/svn/davesvn/conf

[root@singledb conf]# ls

authz  passwd  svnserve.conf

 

(1)svnserve.conf:  svn服务配置文件下。

(2)passwd: 用户名口令文件。

(3)authz: 权限配置文件。 

 

svnserve.conf 文件, 该文件配置项分为以下5项:

       anon-access: 控制非鉴权用户访问版本库的权限。

       auth-access:  控制鉴权用户访问版本库的权限。

       password-db: 指定用户名口令文件名。

       authz-db:指定权限配置文件名,通过该文件可以实现以路径为基础的访问控制。

       realm:指定版本库的认证域,即在登录时提示的认证域名称。若两个版本库的认证域相同,建议使用相同的用户名口令数据文件

 

 

Passwd 文件 :

       我们在svnserve.conf文件里启用这个文件。然后配置如下:

[root@singledb conf]# 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

dave = davepwd

tianlesoftware = tianlesoftwarepwd

 

 

authz  文件 :

在网上找到一个很好的配置例子:

[groups]

admin = john, kate

devteam1 = john, rachel, sally

devteam2 = kate, peter, mark

docs = bob, jane, mike

training = zak

--这里把不同用户放到不同的组里面,下面在设置目录访问权限的时候,用目录来操作就可以了。

 

# 为所有库指定默认访问规则

# 所有人可以读,管理员可以写,危险分子没有任何权限

[/]  --对应我测试里的:/u02/svn 目录

* = r

@admin = rw

dangerman =

 

# 允许开发人员可以完全访问他们的项目版本库

[proj1:/]

@devteam1 = rw

[proj2:/]

@devteam2 = rw

[bigproj:/]

@devteam1 = rw

@devteam2 = rw

trevor = rw

 

# 文档编写人员对所有的docs目录有写权限

[/trunk/doc]

@docs = rw

 

# 培训人员可以完全访问培训版本库

[TrainingRepos:/]

@training = rw

 

下面我们来配置我们的authz文件:

[root@singledb conf]# cat authz

[groups]

admin = dave

dev=tianlesoftware

[davesvn:/]

@admin = rw

@dev = rw

[root@singledb conf]#

 

 

2.4 启动和停止SVN服务

(1)启动SVN服务:

[root@singledb conf]# svnserve -d -r /u02/svn

       -d表示后台运行

       -r 指定根目录是 /u02/svn

[root@singledb conf]# ps -ef | grep svn

root      4592     1  0 18:04 ?        00:00:00 svnserve -d -r /u02/svn

root      4594  3709  0 18:04 pts/1    00:00:00 grep svn

(2)停止SVN服务:

ps -aux |grep svn

kill -9 进程杀掉

posted on 2013-09-26 10:29  snowcolin  阅读(179)  评论(0编辑  收藏  举报

期待你的评论交流