好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

linux centOS下SVN配置教程

一、使用yum安装svn包

1、yum安装

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

 

2、验证安装版本

[root@localhost ~]# svn --version

svn, version 1.6.11 (r934486)

   compiled Mar  6 2014, 10:49:10

 

Copyright (C) 2000-2009 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 access (RA) modules are available:

 

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.

  - handles 'http' scheme

  - handles 'https' scheme

* ra_svn : Module for accessing a repository using the svn network protocol.

  - with Cyrus SASL authentication

  - handles 'svn' scheme

* ra_local : Module for accessing a repository on local disk.

  - handles 'file' scheme

  

3、检测:

[root@localhost conf]# lsof -i:3690

COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

svnserve 11970 root    3u  IPv4  71697      0t0  TCP *:svn (LISTEN)

 

测试服务器

  # svn co svn://192.168.60.10/project

  Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

  Password for 'root':

  Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

  Username: server_group

  Password for 'server_group':

  svn: Authorization failed ( server_group没用根目录的访问权 )

 

  # svn co svn://192.168.60.10/project

  Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

  Password for 'root':

  Authentication realm: <svn://192.168.60.10:3690> 92731041-2dae-4c23-97fd-9e1ed7f0d18d

  Username: pm

  Password for 'pm':

  A    project/test

  A    project/server

  A    project/client

  Checked out revision 1.  ( 测试提取成功 )

 

  # cd project/server

  # vim main.c

  # svn add main.c

  # svn commit main.c -m "测试一下我的C程序,看什么看,不行啊??"

  Adding         main.c

  Transmitting file data .

  Committed revision 2.  ( 测试提交成功 )

 

4、创建SVN版本库

  [root@localhost ~]# mkdir -p /data/svn

  [root@localhost ~]# svnadmin create /data/svn/u88svn  #u88svn为版本库名称

  

二、SVN配置

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

  [root@localhost conf]# pwd

/data/svn/u88svn/conf

[root@localhost conf]# ls

authz  passwd  svnserve.conf

#svnserve.conf:    svn服务配置文件

#passwd:    用户名口令文件

#authz:    权限配置文件

 

1、svnserve.conf文件

[root@localhost conf]# cat svnserve.conf

 

[general]

 anon-access = none

 auth-access = write

 password-db = passwd

 authz-db = authz

 realm = u88

# realm = My First Repository

 

[sasl]

# use-sasl = true

# min-encryption = 0

# max-encryption = 256

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

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

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

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

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

 

 2、passwd文件

 [root@localhost conf]# cat passwd

 

[users]

# harry = harryssecret

# sally = sallyssecret

 

u88svn = 123456

tianlesoftware = 123456789

 

3、authz文件

[root@localhost conf]# cat 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,&joe

 

# [/foo/bar]

# harry = rw

# &joe = r

# * =

 

# [repository:/baz/fuz]

# @harry_and_sally = rw

# * = r

 

admin = hanqiang,zhangchang

php = feishuyong,banqing

 

 

[u88svn:/]

* = r

@admin = rw

dangerman = 

 

三、启动和停止SVN服务

1、启动SVN服务:

[root@localhost ~]# svnserve -d -r /data/svn

[root@localhost ~]# ps -ef | grep svn

root     11970     1  0 00:23 ?        0 svnserve -d -r /data/svn

root     11972  1666  0 00:23 pts/1    0 grep svn

 

2、停止SVN服务

ps -aux |grep svn

kill -9 

 

四、客户端连接SVN服务器

客户端下载地址:

http://tortoisesvn.net/downloads.html

 

 

 

查看更多关于linux centOS下SVN配置教程的详细内容...

  阅读:49次