linux(centos)搭建SVN服务器

 
安装步骤如下:

1、yum install subversion

[root@iZ239yqa63mZ static]# yum install subversion
Loaded plugins: security
base                                                     | 3.7 kB     00:00     
epel                                                     | 4.4 kB     00:00     
epel/primary_db                                          | 6.5 MB     00:01     
extras                                                   | 3.4 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/primary_db                                       | 2.7 MB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package subversion.x86_64 0:1.6.11-10.el6_5 will be updated
---> Package subversion.x86_64 0:1.6.11-12.el6_6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch          Version                   Repository      Size
================================================================================
Updating:
 subversion        x86_64        1.6.11-12.el6_6           updates        2.3 M

Transaction Summary
================================================================================
Upgrade       1 Package(s)

Total download size: 2.3 M
Is this ok [y/N]: y
Downloading Packages:
subversion-1.6.11-12.el6_6.x86_64.rpm                    | 2.3 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : subversion-1.6.11-12.el6_6.x86_64                            1/2 
  Cleanup    : subversion-1.6.11-10.el6_5.x86_64                            2/2 
  Verifying  : subversion-1.6.11-12.el6_6.x86_64                            1/2 
  Verifying  : subversion-1.6.11-10.el6_5.x86_64                            2/2 

Updated:
  subversion.x86_64 0:1.6.11-12.el6_6                                           

Complete!

 

2、输入rpm -ql subversion查看安装位置,如下:

[root@iZ239yqa63mZ static]# rpm -ql subversion
/etc/bash_completion.d
/etc/bash_completion.d/subversion
/etc/rc.d/init.d/svnserve
/etc/subversion
/usr/bin/svn
/usr/bin/svnadmin
/usr/bin/svndumpfilter
/usr/bin/svnlook
/usr/bin/svnserve
/usr/bin/svnsync
/usr/bin/svnversion
....
我们知道svn在bin目录下生成了几个二进制文件。
输入 svn --help可以查看svn的使用方法,如下图。
[root@iZ239yqa63mZ static]#  svn --help
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.6.11.
Type 'svn help <subcommand>' for help on a specific subcommand.
Type 'svn --version' to see the program version and RA modules
  or 'svn --version --quiet' to see just the version number.

Most subcommands take file and/or directory arguments, recursing
on the directories.  If no arguments are supplied to such a
command, it recurses on the current directory (inclusive) by default.

Available subcommands:
   add
   blame (praise, annotate, ann)
   cat
   changelist (cl)
   checkout (co)
   cleanup
   commit (ci)
   copy (cp)
   delete (del, remove, rm)
   diff (di)
   export
   help (?, h)
   import
   info
   list (ls)
   lock
   log
   merge
   mergeinfo
   mkdir
   move (mv, rename, ren)
   propdel (pdel, pd)
   propedit (pedit, pe)
   propget (pget, pg)
   proplist (plist, pl)
   propset (pset, ps)
   resolve
   resolved
   revert
   status (stat, st)
   switch (sw)
   unlock
   update (up)

Subversion is a tool for version control.
For additional information, see http://subversion.tigris.org/

 

3、创建svn版本库目录
mkdir -p /alidata/www/static/svn/svnrepos

 

4、创建版本库
svnadmin create /alidata/www/svn/svnrepos
执行了这个命令之后会在/alidata/www/svn/svnrepos目录下生成如下这些文件

# ls /alidata/www/svn/svnrepos
conf  db  format  hooks  locks  README.txt

 

5、进入conf目录(该svn版本库配置文件)
 
passwd是帐号密码文件
authz文件是权限控制文件
svnserve.conf SVN服务配置文件
 
6、设置帐号密码
vi passwd
在[users]块中添加用户和密码,格式:帐号=密码,如dan=dan
 
7、设置权限
vi authz
在末尾添加如下代码:
[/]
dan=rw
w=r
@g_admin = rw
意思是版本库的根目录dan对其有读写权限,w只有读权限。
 
 
8、修改svnserve.conf文件
vi svnserve.conf
打开下面的几个注释:
anon-access = read #匿名用户可读
auth-access = write #授权用户可写
password-db = passwd #使用哪个文件作为账号文件
authz-db = authz #使用哪个文件作为权限文件
realm = /alidata/www/svn/svnrepos # 认证空间名,版本库所在目录
 
9、启动svn版本库
svnserve -d -r /alidata/www/svn/svnrepos
 
 
 
 

 

posted @ 2015-04-09 17:21  mjorcen  阅读(196)  评论(0编辑  收藏  举报