日期:2014-05-16  浏览次数:20813 次

Subversion服务器的安装与配置
以下安装,是配置的局域网的代码管理环境。


Subversion   是新一代的开源版本控制系统,用以取代CVS。有关Subversion最详尽的资料就是官方的Subversion   Book了。它是由开源社区编写的自由图书,已通过O 'Reilly   Media出版。下面简单介绍一下Subversion在Debian下的安装和配置过程。
安装
debian:~#   apt-get   install   subversion   subversion-tools
如果已经安装了svn服务器,则跳过这一步
创建一个新的储存库
debian:~#   svnadmin   create   /home/bruce/SVNROOT/(projectname)
其中,/home/bruce/SVNROOT/(projectname)是SVN代码库的路径。目前的系统中统一存放在/home/bruce/SVNROOT下
导入源码
debian:~#   svn   import   (sourcepath)   file://(destpath)
将源目录的文件导入到库中
Sourcepath是原始源代码库的绝对路径
destpath是上一步创建的新库的绝对路径

导入过程会要求写日志文件,注意日志文件虽然有没有并不影响系统运行,但是这个过程必须要写完,而且要保存到合适的位置,不要乱放(或者随便放在一个可以看到的位置,回头删掉它)
服务器配置
修改配置文件(destpath)/conf/svnserve.conf
代码

#去掉#[general]前面的#号
[general]
#匿名访问的权限,可以是read,write,none,默认为read
anon-access   =   none   #这是禁止匿名访问
#认证用户的权限,可以是read,write,none,默认为write
auth-access   =   write
#密码数据库的路径,去掉前面的#
password-db   =   passwd   #指定密码文件的位置,不带路径则表示是当前目录,建议使用
Authz_db   =   authz   #指定授权文件的位置,不带路径则表示是当前目录,建议使用
注意:所有的行都必须顶格,否则报错。

修改授权文件
修改authz文件

###   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,   to   a   group   of   users   defined   in   a   special   [groups]
###   section,   or   to   anyone   using   the   '* '   wildcard.     Each   definition   can
###   grant   read   ( 'r ')   access,   read-write   ( 'rw ')   access,   or   no   access
###   ( ' ').

[groups]
#   harry_and_sally   =   harry,sally
A6_Team   =   bruce

#   [/foo/bar]
#   harry   =   rw
#   *   =
[/]
*   =   r
bruce   =   rw

#   [repository:/baz/fuz]
#   @harry_and_sally   =   rw
#   *   =   r
修改密码文件
###   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
bruce   =   123456

注意:
1、密码是明文
2、当前采用的方式是:一个SVN根目录/home/bruce/SVNROOT,下面可以装若干个工程。每个工程有独立的用户名和密码授权。所有的工程共用授权和密码库的情况下,总授权文件的编写就会非常麻烦

启动svn服务
用netstat   –l   |grep &nb