linux系统Centos环境下如何搭建SVN服务器_服务器
至于svn的概念,这里就不做详细阐述了,可以自行百度。简单来讲就是一个代码管理工具。本笔记就是记录下svn安装搭建步骤而已。
1,yum安装svn

yum install subversion -y

2.验证是否安装完成
svnserve –version
如显示svn版本以及介绍信息,说明svn安装成功。或直接netstat 或ps查看也可以。

3,创建svn版本库
mkdir /home/svn   #把版本库放在了var目录下的svn文件夹
svnadmin create /home/svn/repo0 #将svn作为所有版本库的目录,并创建了一个名为repo0的版本库

4.配置当前的版本库
创建版本库后,在当前版本库目录中会生成下面的文件,重点是配置文件。

[root@21yunwei svn]# cd  /home/svn/repo0[root@21yunwei repo0]# ll总用量 24drwxr-xr-x 2 root root 4096 5月   5 05:50 confdrwxr-sr-x 6 root root 4096 5月   5 05:50 db-r--r--r-- 1 root root    2 5月   5 05:50 formatdrwxr-xr-x 2 root root 4096 5月   5 05:50 hooksdrwxr-xr-x 2 root root 4096 5月   5 05:50 locks-rw-r--r-- 1 root root  229 5月   5 05:50 README.txt[root@21yunwei repo0]# ll conf总用量 12-rw-r--r-- 1 root root 1080 5月   5 05:50 authz-rw-r--r-- 1 root root  309 5月   5 05:50 passwd-rw-r--r-- 1 root root 2279 5月   5 05:50 svnserve.conf

说明

(1)svnserve.conf:  svn服务综合配置文件。
(2)passwd: 用户名口令文件。配置哪些用户可以授权使用,里边包含用户名和密码。
(3)authz: 权限配置文件。

4.1 修改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 = sallyssecretzhangsan=123456lisi=123456

4.2修改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,&joeteam0=zhangsan #将上面创建的分成两个组team1=lisi# [/foo/bar]# harry = rw# &joe = r #上面的别名定义在这里实现 &在这里理解为指针就很容易了# * =# [repository:/baz/fuz]# @harry_and_sally = rw# * = r[repo0:/]@team0=r@team1=rw# 第一个小组只有读取的权限,第二个小组有读写的权限# 单个版本库的权限配置在这个文件中实现

 4.3 修改svnserve.conf并重启svn
vi  svnserve.conf 主要修改如下参数:
anon-access = none
auth-access = write
password-db = passwd
authz-db = authz

[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 = none #没有登录的用户不能访问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 #密码文件为当前目录下的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 #验证文件为当前目录下的authz

这里着重说明下,参数前面不要有空格,否则启动报错。
5 导入、导出工程

导入

$ mkdir MyProject$ mkdir MyProject/hehe$ mkdir MyProject/hahasvn import MyProject svn://192.168.1.112/repo0/MyProject -m "first import project"

导出

svn co svn://192.168.1.112/repo0/MyProject