版本控制svn服务器搭建

ubuntu服务器:

1
sudo  apt-get  install  subversion


centos和redhat服务器:

1
yum  install  subversion


当前系统yum自带的版本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@localhost xiaomeng] # yum list | grep subversion
subversion.x86_64                           1.6.11-15.el6_7              @base  
subversion.i686                             1.6.11-15.el6_7              base   
subversion-devel.i686                       1.6.11-15.el6_7              base   
subversion-devel.x86_64                     1.6.11-15.el6_7              base   
subversion-gnome.i686                       1.6.11-15.el6_7              base   
subversion-gnome.x86_64                     1.6.11-15.el6_7              base   
subversion-javahl.i686                      1.6.11-15.el6_7              base   
subversion-javahl.x86_64                    1.6.11-15.el6_7              base   
subversion-kde.i686                         1.6.11-15.el6_7              base   
subversion-kde.x86_64                       1.6.11-15.el6_7              base   
subversion-perl.i686                        1.6.11-15.el6_7              base   
subversion-perl.x86_64                      1.6.11-15.el6_7              base   
subversion-ruby.i686                        1.6.11-15.el6_7              base   
subversion-ruby.x86_64                      1.6.11-15.el6_7              base   
subversion-svn2cl.noarch                    1.6.11-15.el6_7              base


查看当前安装的版本:

1
2
[root@localhost xiaomeng] # rpm -qa subversion
subversion-1.6.11-15.el6_7.x86_64


查看帮助通过svn ?:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[root@localhost xiaomeng] # svn ?
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


新建一个目录作为svn库:

1
mkdir  -p  /data/www


创建一个svn库:

1
svnadmin create  /data/www


进入conf目录(该svn版本库配置文件)

authz文件是权限控制文件

passwd是帐号密码文件

svnserve.conf SVN服务配置文件

wKioL1jGWTGinVhiAAAfkJcSdNg321.png


修改svnserve.conf文件

1
2
3
4
5
6
7
vi  svnserve.conf
打开下面的几个注释:
anon-access = none  #匿名用户可读
auth-access = write  #授权用户可写
password-db =  passwd  #使用哪个文件作为账号文件
authz-db = authz  #使用哪个文件作为权限文件
realm =  /data/www  # 认证空间名,版本库所在目录


vi passwd

在[users]块中添加用户和密码,格式:帐号=密码,如meng=123456


vi authz

1
2
3
在末尾添加如下代码:
[/]
meng=rw


启动svn版本库

svnserve -d -r /var/svn/svnrepos


客户端测试:

wKiom1jGWgGxywuwAACeeIJNsdA938.png


上传文件测试:

wKiom1jGWknhIE5oAAEFznMmY8I678.png

update测试:

wKiom1jGWozDbi_YAADcrxIpc_U701.png