CentOS 6.4中搭建svn服务器

2015/03/2113:57:14 发表评论

1、安装subversion

yum install subversion -y

2、查看安装文件

# 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

3、查看svn命令使用方法

# 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)

4、创建svn版本目录

mkdir /data/svn -p

5、创建svn版本库

svnadmin create /data/svn

6、配置用户

cd /data/svn/conf
echo "guozi = xxxx" >> password

其中guozi为用户名,xxxx为密码

7、配置权限

[/]
guozi = rw

意思是版本库的根目录(/data/svn)guozi对其有读写权限。扩展一下,[groups]节点可以添加组,比如:

MyProject = guozi,xiaoming

然后可以在[/]下边加上 @MyProject = rw,意思是对MyProject组给可读可写权限。

你还可以设置多个目录,比如[dev:/]节点,表示/data/svn/dev目录进行权限设置,更多设置请查看svn官方文档。

8、开放配置文件

打开svnserver.conf,根据以下说明配置好权限

anon-access = none
auth-access = write #授权用户可写
password-db = passwd #使用哪个文件作为账号文件
authz-db = authz #使用哪个文件作为权限文件

9、修改启动文件

将/etc/init.d/svnserve文件中的args参数修改如下:

args="--daemon --pid-file={pidfile} OPTIONS -d -r /data/svn"

10、启动svn

/etc/init.d/svnserve start

11、将svnserve加入开机启动

chkconfig svnserve on

 

  • 微信扫码赞助
  • weinxin
  • 支付宝赞助
  • weinxin

发表评论

您必须才能发表评论!