Sealyu

--- 博客已迁移至: http://www.sealyu.com/blog

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  618 随笔 :: 87 文章 :: 225 评论 :: 0 Trackbacks
作者:sealyu
1. 简介
SubVersion 是新一代的版本控制工具,不仅可以管理程序源代码,而且也可用于文档或其他相关资料的管理。
2. 下载
svnsetup.exe   http://subversion.tigris.org
客户端TortoiseSVN http://tortoisesvn.net/downloads
3. 安装步骤
  1)安装刚才下载的软件
  下面假设svnsetup的安装目录为
 C:\Program Files\Subversion
 您想建svn库的文件夹为 E:\svn
  
  2)创建库
  在E:\svn下,右键-》TortoiseSVN->Create Repository here.
会在此文件夹下创建一个版本库,生成所需的文件。
  3)创建为Windows自动运行的服务
  Subversion 从1.4版本开始,可以以windows系统服务的形式在开机时自动运行。但Subversion安装程序还不能把自己安装成windows服务,需要我们自己进行手动安装,方法如下: 打开一个DOS命令窗口,执行如下命令:  
sc create svnserve binPath= "\"C:\Program Files\Subversion\bin\svnserve.exe\" --service --root E:\svn" displayname= "Subversion Repository" depend= Tcpip start= auto   
其中,sc是windows自带的服务配置程序,参数binPath表示svnserve可执行文件的安装路径,由于路径中的"Program Files"带有空格,因此整个路径需要用双引号引起来。而双引号本身是个特殊字符,需要进行转移,因此在路径前后的两个双引号都需要写成\"
-- service参数表示以windows服务的形式运行,--root指明svn repository的位置,service参数与root参数都作为binPath的一部分,因此与svnserve.exe的路径一起被包含在一对双引号当中,而这对双引号不需要进行转义。
displayname表示在windows服务列表中显示的名字, depend =Tcpip 表示svnserve服务的运行需要tcpip服务,start=auto表示开机后自动运行。  
安装服务后,svnserve要等下次开机时才会自动运行。  
若要卸载svn服务,则执行 sc delete svnserve 即可。  
4)配置访问权限
 1 配置仓库
SVN的svnserve对于每个仓库,有一个独立的配置文件和独立的用户、权限管理。
在这里仍然要保持配置文件svnserve.conf的独立,但是用户、权限管理是用统一的一个文件来存储。
这样方便以后的管理和维护。
另外要注意,即使svnserve服务已经运行,修改配置文件或者用户、权限管理文件,保存后马上生效,不需要重启服务。
假设已经配置两个仓库: source1和source2,都在E:\svn下.
我们在E:\svn下放两个文件:passwd.conf 和authz.conf
1.1 配置source1仓库
进入仓库目录
1.2 修改配置
你可以直接删除默认的svnserve.conf文件,然后使用下面的配置:
编辑svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ..\..\passwd
authz-db = ..\..\authz
realm = My First Repository
说明:
anon-access = none #不允许匿名用户访问
auth-access = write #通过验证的用户可以读和写
password-db = ..\..\passwd#用户保存文件
authz-db = ..\..\authz#权限管理文件
realm = My First Repository #仓库名称
1.3 配置source2仓库
进入仓库目录
1.4 修改配置
你可以直接删除默认的svnserve.conf文件,然后使用下面的配置:
编辑svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ..\..\passwd
authz-db = ..\..\authz
realm = My Second Repository
如果有更多的仓库,可以类推配置。
----------------------------------------------------------------------
svnserve.conf的原始内容:
### 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 conf directory.
### 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 conf
### directory. 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
----------------------------------------------------------------------
2 用户管理
2.1 创建用户存储文件
编辑passwd
2.2 设置用户帐号
[users]
harry = harryssecret
sally = sallyssecret
bote = botessecret
说明:
[users] #是必须的,标记为用户配置开始
harry = harryssecret # harry 是用户名 , harryssecret是密码。注意,是明文密码
sally = sallyssecret # 同上
bote = botessecret # 同上
往后所以仓库的用户都在这里记录就可以了。至于那个用户,允许访问那个仓库,在权限管理里限制。
3 权限管理
3. 1 创建权限管理文件
编辑authz.conf
3.2 设置权限管理
[groups]
source1 = harry
source2 = sally
[source1:/]
@source1 = rw
@source2 = r

[source2:/]
@source2 = rw
bote = rw

posted on 2008-04-24 16:35 seal 阅读(2178) 评论(3)  编辑  收藏 所属分类: 版本控制

评论

# re: SubVersion(SVN) 安装说明 2008-04-25 12:04 如坐春风
mark  回复  更多评论
  

# re: SubVersion(SVN) 安装说明 2008-04-26 18:55 x.matthew
有没有服务配置和使用这方面的说明文档,能共享一下吗?  回复  更多评论
  

# re: SubVersion(SVN) 安装说明 2008-04-26 22:22 sealyu
文档有的,不过建议你看官方文档。其他的也有一些,如果需要,可以联系我:sealyu@hotmail.com. 共同进步!
  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: