美文网首页
从搭建linux的SVN 服务器开始

从搭建linux的SVN 服务器开始

作者: 斐波那契的数字 | 来源:发表于2017-08-21 22:48 被阅读13次

PS:

SVN是一个控制版本的利器.  是Subversion的简称,是一个开放源代码的版本控制系统,相较于RCS、CVS,它采用了分支管理系统,它的设计目标就是取代CVS。互联网上很多版本控制服务已从CVS迁移到Subversion。说得简单一点SVN就是用于多个人共同开发同一个项目,共用资源的目的。

软件环境: 

CentOS7 ;

初级教程: 

Step1:  安装svn 服务器

yum install subversion

# 普通用户使用  sudo yum 命令安装

Step2: 创建SVN 仓库

在设置svn 仓库的时候我希望自己的SVN 是这样子的: 

svn 目录示意图

也就是说将来在  /home/liz/paper_svn 目录下面会建立很多的svn 仓库.  首先需要保证这个目录存在. 

所以,我们先建立这个目录:

mkdir -p /home/liz/paper_svn  # 创建目录

cd  /home/liz/paper_svn # 由于要在给目录下创建仓库,所以要切换到/home/liz/paper_svn 目录下

在该目录下我们可以创建属于自己的仓库

svnadmin create  ./ecgProject # 在当前目录下创建SVN 版本库

创建好了以后, svnadmin 下会创建以下文件夹( 命令  ls -al ecgProject/)

使用 ls -al ecgProject/ 的输出结果

其中,  conf  存放的是与版本库相关的配置文件,这个目录是稍后的重点操作对象

这里给出一个表格

假装这是一个table , 其实是image :)

revs下面是以目录组织的版本结构,每1000个版本组成一个目录,每个版本自成一个文件,文件名即为commit后生成的版本号;即使删除掉部分版本也不会影响版本库的读取和显示;但是基础版本丢失会使版本库无法访问;

Step3. 修改版本库的配置文件

3.1 创建svn 用户:

svn 用户的信息保存在 conf/passwd 文件中.

所以: 

vim ./ecgProject/conf/passwd  # 编辑passwd 并添加用户

找到[users]并在下方写出  <用户名>=<密码>  ,  编辑内容如下下图所示. 

创建了三个用户, 其中用户名liz的密码是liz123

3.2 设置用户的权限

编辑authz 文件

vim ./ecgProject/conf/authz

设置版本库的所有者

[groups]

authors=<用户名1>[,用户名2]

设置版本库的 所有者的权限 

[<版本库的名字>:<svn相对路径>]

@authors=rw

*=

如下图所示:

demo

3.4 服务器的版本设置

[general]

下面把 以下字段的注释打开: 

anon-access = read

auth-access = write

password-db = passwd

authz-db = authz

like this:

这四个到底是什么意思呢, 好奇宝宝可以看看上面英语解释

这里给出详细的:

### Visit http://subversion.apache.org/ for more information.

[general]

### Theanon-access and auth-access options control access to the

### repository for unauthenticated (a.k.a.anonymous) users and

### authenticated users, respectively.

### Valid values are "write", "read", and "none".

### Setting the value to "none" prohibits both reading and writing;

### "read" allows read-only access, and "write" allows complete

### read/write access to the repository.

### The sample settings below are the defaults and specify thatanonymous

### users have read-only access to the repository, while authenticated

### users have read and write access to the repository.

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 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 = My First Repository

### The force-username-case option causes svnserve to case-normalize

### usernames before comparing them against the authorization rules in the

### authz-db file configured above.Valid values are "upper" (to upper-

### case the usernames), "lower" (to lowercase the usernames), and

### "none" (to compare usernames as-is without case conversion, which

### is the default behavior).

# force-username-case = none

Step4 开启服务:

注意我们的目录地址  是到版本路的父目录上

svnserve-d -r /home/liz/paper_svn/ecgProject/  # -r 代表地递归的 , -d 代表目录

Step5 结束服务进程

ps -e |grep svn

 kill <进程号>



Mac 客户端的安装

http://www.subversiondownload.com/macosx

or 

寻找 Cornerstone303[MAS].dmg 的破解版吧   

我用的是破解版.

Cornerstone 客户端安装好以后是这个样子, 经过半天摸索以后知道在哪里写仓库信息了  :( 

如图

点击箭头所指的地方添加信息

会弹出以下方框  

其中红色的方框填写你的服务器IP , 蓝色填写你的地址 要与你在authz中写的一致

绿色填写你的用户名, 要与passwd中写的一致

可能出现的错误:

错误代码 20001 ;

应该是你写的conf 的时候, 某一行的开头出现空格导致的

错误代码20051: 应该是你的路径写错了

相关文章

网友评论

      本文标题:从搭建linux的SVN 服务器开始

      本文链接:https://www.haomeiwen.com/subject/vyghdxtx.html