SVN-linux配置

CentOS中安装SVN服务端:

方法一:

[root@localhost ~]# svn --version
bash: svn: 未找到命令...
安装软件包“subversion”以提供命令“svn”? [N/y] 

直接输入y会自动安装,安装完成后再输入svn --version查看:

[root@localhost ~]# svn --version
svn,版本 1.10.2 (r1835932)
   编译于 Jun 24 201919:19:14 在 x86_64-redhat-linux-gnu

Copyright (C) 2018 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

可使用以下的版本库访问模块: 

* ra_svn : 使用 svn 网络协议访问版本库的模块。  - 使用 Cyrus SASL 认证
  - 处理“svn”方案
* ra_local : 访问本地磁盘的版本库模块。
  - 处理“file”方案
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.9 (compiled with 1.3.9)
  - 处理“http”方案
  - 处理“https”方案

The following authentication credential caches are available:

* Plaintext cache in /root/.subversion
* Gnome Keyring
* GPG-Agent
View Code

 

方法二:

yum search svnserve(可省)

[root@localhost ~]# svn --version
-bash: svn: 未找到命令
[root@localhost ~]# yum search svnserve
已加载插件:fastestmirror
base                                                                    | 3.6 kB  00:00:00     
extras                                                                  | 2.9 kB  00:00:00     
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
12: Timeout on http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')


 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: updates/7/x86_64
View Code

yum install subversion -y(直接输入此命令就可安装SVN服务端)

[root@localhost ~]# yum install subversion -y
已加载插件:fastestmirror
base                                                                    | 3.6 kB  00:00:00     
extras                                                                  | 2.9 kB  00:00:00     
updates                                                                 | 2.9 kB  00:00:00     
(1/2): base/7/x86_64/group_gz                                           | 165 kB  00:00:00     
(2/2): base/7/x86_64/primary_db                                         | 6.0 MB  00:00:01     
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 subversion.x86_64.0.1.7.14-14.el7 将被 安装
--> 正在处理依赖关系 subversion-libs(x86-64) = 1.7.14-14.el7,它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 perl(strict),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 perl(Carp),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_wc-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_subr-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_repos-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_ra_svn-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_ra_neon-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_ra_local-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_ra-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_fs_util-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_fs_fs-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_fs_base-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_fs-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_diff-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_delta-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libsvn_client-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libneon.so.27()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 subversion-1.7.14-14.el7.x86_64 需要
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-5.el7 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 安装
---> 软件包 neon.x86_64.0.0.30.0-4.el7 将被 安装
--> 正在处理依赖关系 libpakchois.so.0()(64bit),它被软件包 neon-0.30.0-4.el7.x86_64 需要
---> 软件包 perl.x86_64.4.5.16.3-294.el7_6 将被 安装
--> 正在处理依赖关系 perl-libs = 4:5.16.3-294.el7_6,它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Socket) >= 1.3,它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Scalar::Util) >= 1.10,它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl-macros,它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl-libs,它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(threads::shared),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(threads),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(constant),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Time::Local),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Time::HiRes),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Storable),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Socket),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Scalar::Util),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Pod::Simple::XHTML),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Pod::Simple::Search),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Getopt::Long),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Filter::Util::Call),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(File::Temp),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(File::Spec::Unix),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(File::Spec::Functions),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(File::Spec),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(File::Path),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Exporter),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 perl(Cwd),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
--> 正在处理依赖关系 libperl.so()(64bit),它被软件包 4:perl-5.16.3-294.el7_6.x86_64 需要
---> 软件包 perl-Carp.noarch.0.1.26-244.el7 将被 安装
---> 软件包 subversion-libs.x86_64.0.1.7.14-14.el7 将被 安装
--> 正在检查事务
---> 软件包 pakchois.x86_64.0.0.4-10.el7 将被 安装
---> 软件包 perl-Exporter.noarch.0.5.68-3.el7 将被 安装
---> 软件包 perl-File-Path.noarch.0.2.09-2.el7 将被 安装
---> 软件包 perl-File-Temp.noarch.0.0.23.01-3.el7 将被 安装
---> 软件包 perl-Filter.x86_64.0.1.49-3.el7 将被 安装
---> 软件包 perl-Getopt-Long.noarch.0.2.40-3.el7 将被 安装
--> 正在处理依赖关系 perl(Pod::Usage) >= 1.14,它被软件包 perl-Getopt-Long-2.40-3.el7.noarch 需要
--> 正在处理依赖关系 perl(Text::ParseWords),它被软件包 perl-Getopt-Long-2.40-3.el7.noarch 需要
---> 软件包 perl-PathTools.x86_64.0.3.40-5.el7 将被 安装
---> 软件包 perl-Pod-Simple.noarch.1.3.28-4.el7 将被 安装
--> 正在处理依赖关系 perl(Pod::Escapes) >= 1.04,它被软件包 1:perl-Pod-Simple-3.28-4.el7.noarch 需要
--> 正在处理依赖关系 perl(Encode),它被软件包 1:perl-Pod-Simple-3.28-4.el7.noarch 需要
---> 软件包 perl-Scalar-List-Utils.x86_64.0.1.27-248.el7 将被 安装
---> 软件包 perl-Socket.x86_64.0.2.010-4.el7 将被 安装
---> 软件包 perl-Storable.x86_64.0.2.45-3.el7 将被 安装
---> 软件包 perl-Time-HiRes.x86_64.4.1.9725-3.el7 将被 安装
---> 软件包 perl-Time-Local.noarch.0.1.2300-2.el7 将被 安装
---> 软件包 perl-constant.noarch.0.1.27-2.el7 将被 安装
---> 软件包 perl-libs.x86_64.4.5.16.3-294.el7_6 将被 安装
---> 软件包 perl-macros.x86_64.4.5.16.3-294.el7_6 将被 安装
---> 软件包 perl-threads.x86_64.0.1.87-4.el7 将被 安装
---> 软件包 perl-threads-shared.x86_64.0.1.43-6.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Encode.x86_64.0.2.51-7.el7 将被 安装
---> 软件包 perl-Pod-Escapes.noarch.1.1.04-294.el7_6 将被 安装
---> 软件包 perl-Pod-Usage.noarch.0.1.63-3.el7 将被 安装
--> 正在处理依赖关系 perl(Pod::Text) >= 3.15,它被软件包 perl-Pod-Usage-1.63-3.el7.noarch 需要
--> 正在处理依赖关系 perl-Pod-Perldoc,它被软件包 perl-Pod-Usage-1.63-3.el7.noarch 需要
---> 软件包 perl-Text-ParseWords.noarch.0.3.29-4.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-Pod-Perldoc.noarch.0.3.20-4.el7 将被 安装
--> 正在处理依赖关系 perl(parent),它被软件包 perl-Pod-Perldoc-3.20-4.el7.noarch 需要
--> 正在处理依赖关系 perl(HTTP::Tiny),它被软件包 perl-Pod-Perldoc-3.20-4.el7.noarch 需要
---> 软件包 perl-podlators.noarch.0.2.5.1-3.el7 将被 安装
--> 正在检查事务
---> 软件包 perl-HTTP-Tiny.noarch.0.0.033-3.el7 将被 安装
---> 软件包 perl-parent.noarch.1.0.225-244.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===============================================================================================
 Package                        架构           版本                         源            大小
===============================================================================================
正在安装:
 subversion                     x86_64         1.7.14-14.el7                base         1.0 M
为依赖而安装:
 apr                            x86_64         1.4.8-5.el7                  base         103 k
 apr-util                       x86_64         1.5.2-6.el7                  base          92 k
 neon                           x86_64         0.30.0-4.el7                 base         166 k
 pakchois                       x86_64         0.4-10.el7                   base          14 k
 perl                           x86_64         4:5.16.3-294.el7_6           base         8.0 M
 perl-Carp                      noarch         1.26-244.el7                 base          19 k
 perl-Encode                    x86_64         2.51-7.el7                   base         1.5 M
 perl-Exporter                  noarch         5.68-3.el7                   base          28 k
 perl-File-Path                 noarch         2.09-2.el7                   base          26 k
 perl-File-Temp                 noarch         0.23.01-3.el7                base          56 k
 perl-Filter                    x86_64         1.49-3.el7                   base          76 k
 perl-Getopt-Long               noarch         2.40-3.el7                   base          56 k
 perl-HTTP-Tiny                 noarch         0.033-3.el7                  base          38 k
 perl-PathTools                 x86_64         3.40-5.el7                   base          82 k
 perl-Pod-Escapes               noarch         1:1.04-294.el7_6             base          51 k
 perl-Pod-Perldoc               noarch         3.20-4.el7                   base          87 k
 perl-Pod-Simple                noarch         1:3.28-4.el7                 base         216 k
 perl-Pod-Usage                 noarch         1.63-3.el7                   base          27 k
 perl-Scalar-List-Utils         x86_64         1.27-248.el7                 base          36 k
 perl-Socket                    x86_64         2.010-4.el7                  base          49 k
 perl-Storable                  x86_64         2.45-3.el7                   base          77 k
 perl-Text-ParseWords           noarch         3.29-4.el7                   base          14 k
 perl-Time-HiRes                x86_64         4:1.9725-3.el7               base          45 k
 perl-Time-Local                noarch         1.2300-2.el7                 base          24 k
 perl-constant                  noarch         1.27-2.el7                   base          19 k
 perl-libs                      x86_64         4:5.16.3-294.el7_6           base         688 k
 perl-macros                    x86_64         4:5.16.3-294.el7_6           base          44 k
 perl-parent                    noarch         1:0.225-244.el7              base          12 k
 perl-podlators                 noarch         2.5.1-3.el7                  base         112 k
 perl-threads                   x86_64         1.87-4.el7                   base          49 k
 perl-threads-shared            x86_64         1.43-6.el7                   base          39 k
 subversion-libs                x86_64         1.7.14-14.el7                base         922 k

事务概要
===============================================================================================
安装  1 软件包 (+32 依赖软件包)

总下载量:14 M
安装大小:44 M
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/apr-util-1.5.2-6.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
apr-util-1.5.2-6.el7.x86_64.rpm 的公钥尚未安装
(1/33): apr-util-1.5.2-6.el7.x86_64.rpm                                 |  92 kB  00:00:00     
(2/33): apr-1.4.8-5.el7.x86_64.rpm                                      | 103 kB  00:00:00     
(3/33): pakchois-0.4-10.el7.x86_64.rpm                                  |  14 kB  00:00:00     
(4/33): neon-0.30.0-4.el7.x86_64.rpm                                    | 166 kB  00:00:00     
(5/33): perl-Carp-1.26-244.el7.noarch.rpm                               |  19 kB  00:00:00     
(6/33): perl-Encode-2.51-7.el7.x86_64.rpm                               | 1.5 MB  00:00:00     
(7/33): perl-Exporter-5.68-3.el7.noarch.rpm                             |  28 kB  00:00:00     
(8/33): perl-File-Path-2.09-2.el7.noarch.rpm                            |  26 kB  00:00:00     
(9/33): perl-File-Temp-0.23.01-3.el7.noarch.rpm                         |  56 kB  00:00:00     
(10/33): perl-Filter-1.49-3.el7.x86_64.rpm                              |  76 kB  00:00:00     
(11/33): perl-5.16.3-294.el7_6.x86_64.rpm                               | 8.0 MB  00:00:01     
(12/33): perl-Getopt-Long-2.40-3.el7.noarch.rpm                         |  56 kB  00:00:00     
(13/33): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm                          |  38 kB  00:00:00     
(14/33): perl-PathTools-3.40-5.el7.x86_64.rpm                           |  82 kB  00:00:00     
(15/33): perl-Pod-Escapes-1.04-294.el7_6.noarch.rpm                     |  51 kB  00:00:00     
(16/33): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm                         |  87 kB  00:00:00     
(17/33): perl-Pod-Usage-1.63-3.el7.noarch.rpm                           |  27 kB  00:00:00     
(18/33): perl-Pod-Simple-3.28-4.el7.noarch.rpm                          | 216 kB  00:00:00     
(19/33): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm                 |  36 kB  00:00:00     
(20/33): perl-Socket-2.010-4.el7.x86_64.rpm                             |  49 kB  00:00:00     
(21/33): perl-Storable-2.45-3.el7.x86_64.rpm                            |  77 kB  00:00:00     
(22/33): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm                        |  45 kB  00:00:00     
(23/33): perl-Time-Local-1.2300-2.el7.noarch.rpm                        |  24 kB  00:00:00     
(24/33): perl-constant-1.27-2.el7.noarch.rpm                            |  19 kB  00:00:00     
(25/33): perl-Text-ParseWords-3.29-4.el7.noarch.rpm                     |  14 kB  00:00:00     
(26/33): perl-libs-5.16.3-294.el7_6.x86_64.rpm                          | 688 kB  00:00:00     
(27/33): perl-macros-5.16.3-294.el7_6.x86_64.rpm                        |  44 kB  00:00:00     
(28/33): perl-parent-0.225-244.el7.noarch.rpm                           |  12 kB  00:00:00     
(29/33): perl-threads-1.87-4.el7.x86_64.rpm                             |  49 kB  00:00:00     
(30/33): perl-podlators-2.5.1-3.el7.noarch.rpm                          | 112 kB  00:00:00     
(31/33): perl-threads-shared-1.43-6.el7.x86_64.rpm                      |  39 kB  00:00:00     
(32/33): subversion-libs-1.7.14-14.el7.x86_64.rpm                       | 922 kB  00:00:00     
(33/33): subversion-1.7.14-14.el7.x86_64.rpm                            | 1.0 MB  00:00:00     
-----------------------------------------------------------------------------------------------
总计                                                           5.9 MB/s |  14 MB  00:00:02file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 软件包     : centos-release-7-3.1611.el7.centos.x86_64 (@anaconda)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : apr-1.4.8-5.el7.x86_64                                                    1/33 
  正在安装    : apr-util-1.5.2-6.el7.x86_64                                               2/33 
  正在安装    : 1:perl-parent-0.225-244.el7.noarch                                        3/33 
  正在安装    : perl-HTTP-Tiny-0.033-3.el7.noarch                                         4/33 
  正在安装    : perl-podlators-2.5.1-3.el7.noarch                                         5/33 
  正在安装    : perl-Pod-Perldoc-3.20-4.el7.noarch                                        6/33 
  正在安装    : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch                                  7/33 
  正在安装    : perl-Encode-2.51-7.el7.x86_64                                             8/33 
  正在安装    : perl-Text-ParseWords-3.29-4.el7.noarch                                    9/33 
  正在安装    : perl-Pod-Usage-1.63-3.el7.noarch                                         10/33 
  正在安装    : 4:perl-libs-5.16.3-294.el7_6.x86_64                                      11/33 
  正在安装    : 4:perl-macros-5.16.3-294.el7_6.x86_64                                    12/33 
  正在安装    : perl-Storable-2.45-3.el7.x86_64                                          13/33 
  正在安装    : perl-Exporter-5.68-3.el7.noarch                                          14/33 
  正在安装    : perl-constant-1.27-2.el7.noarch                                          15/33 
  正在安装    : perl-Time-Local-1.2300-2.el7.noarch                                      16/33 
  正在安装    : perl-Socket-2.010-4.el7.x86_64                                           17/33 
  正在安装    : perl-Carp-1.26-244.el7.noarch                                            18/33 
  正在安装    : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                    19/33 
  正在安装    : perl-PathTools-3.40-5.el7.x86_64                                         20/33 
  正在安装    : perl-Scalar-List-Utils-1.27-248.el7.x86_64                               21/33 
  正在安装    : 1:perl-Pod-Simple-3.28-4.el7.noarch                                      22/33 
  正在安装    : perl-File-Temp-0.23.01-3.el7.noarch                                      23/33 
  正在安装    : perl-File-Path-2.09-2.el7.noarch                                         24/33 
  正在安装    : perl-threads-shared-1.43-6.el7.x86_64                                    25/33 
  正在安装    : perl-threads-1.87-4.el7.x86_64                                           26/33 
  正在安装    : perl-Filter-1.49-3.el7.x86_64                                            27/33 
  正在安装    : perl-Getopt-Long-2.40-3.el7.noarch                                       28/33 
  正在安装    : 4:perl-5.16.3-294.el7_6.x86_64                                           29/33 
  正在安装    : pakchois-0.4-10.el7.x86_64                                               30/33 
  正在安装    : neon-0.30.0-4.el7.x86_64                                                 31/33 
  正在安装    : subversion-libs-1.7.14-14.el7.x86_64                                     32/33 
  正在安装    : subversion-1.7.14-14.el7.x86_64                                          33/33 
  验证中      : perl-HTTP-Tiny-0.033-3.el7.noarch                                         1/33 
  验证中      : perl-threads-shared-1.43-6.el7.x86_64                                     2/33 
  验证中      : perl-Storable-2.45-3.el7.x86_64                                           3/33 
  验证中      : 1:perl-Pod-Escapes-1.04-294.el7_6.noarch                                  4/33 
  验证中      : perl-Exporter-5.68-3.el7.noarch                                           5/33 
  验证中      : perl-constant-1.27-2.el7.noarch                                           6/33 
  验证中      : perl-PathTools-3.40-5.el7.x86_64                                          7/33 
  验证中      : neon-0.30.0-4.el7.x86_64                                                  8/33 
  验证中      : 1:perl-parent-0.225-244.el7.noarch                                        9/33 
  验证中      : subversion-1.7.14-14.el7.x86_64                                          10/33 
  验证中      : 4:perl-libs-5.16.3-294.el7_6.x86_64                                      11/33 
  验证中      : perl-File-Temp-0.23.01-3.el7.noarch                                      12/33 
  验证中      : 1:perl-Pod-Simple-3.28-4.el7.noarch                                      13/33 
  验证中      : perl-Time-Local-1.2300-2.el7.noarch                                      14/33 
  验证中      : 4:perl-macros-5.16.3-294.el7_6.x86_64                                    15/33 
  验证中      : perl-Socket-2.010-4.el7.x86_64                                           16/33 
  验证中      : perl-Carp-1.26-244.el7.noarch                                            17/33 
  验证中      : apr-util-1.5.2-6.el7.x86_64                                              18/33 
  验证中      : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                    19/33 
  验证中      : perl-Scalar-List-Utils-1.27-248.el7.x86_64                               20/33 
  验证中      : perl-Pod-Usage-1.63-3.el7.noarch                                         21/33 
  验证中      : perl-Encode-2.51-7.el7.x86_64                                            22/33 
  验证中      : perl-Pod-Perldoc-3.20-4.el7.noarch                                       23/33 
  验证中      : perl-podlators-2.5.1-3.el7.noarch                                        24/33 
  验证中      : apr-1.4.8-5.el7.x86_64                                                   25/33 
  验证中      : perl-File-Path-2.09-2.el7.noarch                                         26/33 
  验证中      : subversion-libs-1.7.14-14.el7.x86_64                                     27/33 
  验证中      : perl-threads-1.87-4.el7.x86_64                                           28/33 
  验证中      : perl-Filter-1.49-3.el7.x86_64                                            29/33 
  验证中      : perl-Getopt-Long-2.40-3.el7.noarch                                       30/33 
  验证中      : perl-Text-ParseWords-3.29-4.el7.noarch                                   31/33 
  验证中      : 4:perl-5.16.3-294.el7_6.x86_64                                           32/33 
  验证中      : pakchois-0.4-10.el7.x86_64                                               33/33 

已安装:
  subversion.x86_64 0:1.7.14-14.el7                                                            

作为依赖被安装:
  apr.x86_64 0:1.4.8-5.el7                         apr-util.x86_64 0:1.5.2-6.el7               
  neon.x86_64 0:0.30.0-4.el7                       pakchois.x86_64 0:0.4-10.el7                
  perl.x86_64 4:5.16.3-294.el7_6                   perl-Carp.noarch 0:1.26-244.el7             
  perl-Encode.x86_64 0:2.51-7.el7                  perl-Exporter.noarch 0:5.68-3.el7           
  perl-File-Path.noarch 0:2.09-2.el7               perl-File-Temp.noarch 0:0.23.01-3.el7       
  perl-Filter.x86_64 0:1.49-3.el7                  perl-Getopt-Long.noarch 0:2.40-3.el7        
  perl-HTTP-Tiny.noarch 0:0.033-3.el7              perl-PathTools.x86_64 0:3.40-5.el7          
  perl-Pod-Escapes.noarch 1:1.04-294.el7_6         perl-Pod-Perldoc.noarch 0:3.20-4.el7        
  perl-Pod-Simple.noarch 1:3.28-4.el7              perl-Pod-Usage.noarch 0:1.63-3.el7          
  perl-Scalar-List-Utils.x86_64 0:1.27-248.el7     perl-Socket.x86_64 0:2.010-4.el7            
  perl-Storable.x86_64 0:2.45-3.el7                perl-Text-ParseWords.noarch 0:3.29-4.el7    
  perl-Time-HiRes.x86_64 4:1.9725-3.el7            perl-Time-Local.noarch 0:1.2300-2.el7       
  perl-constant.noarch 0:1.27-2.el7                perl-libs.x86_64 4:5.16.3-294.el7_6         
  perl-macros.x86_64 4:5.16.3-294.el7_6            perl-parent.noarch 1:0.225-244.el7          
  perl-podlators.noarch 0:2.5.1-3.el7              perl-threads.x86_64 0:1.87-4.el7            
  perl-threads-shared.x86_64 0:1.43-6.el7          subversion-libs.x86_64 0:1.7.14-14.el7      

完毕!
[root@localhost ~]# svn --version
svn,版本 1.7.14 (r1542130)
   编译于 Apr 11 201802:40:28

版权所有 (C) 2013 Apache 软件基金会。
此软件包含了许多人的贡献,请查看文件 NOTICE 以获得更多信息。
Subversion 是开放源代码软件,请参阅 http://subversion.apache.org/ 站点。

可使用以下的版本库访问模块: 

* ra_neon : 通过 WebDAV 协议使用 neon 访问版本库的模块。
  - 处理“http”方案
  - 处理“https”方案
* ra_svn : 使用 svn 网络协议访问版本库的模块。  - 使用 Cyrus SASL 认证
  - 处理“svn”方案
* ra_local : 访问本地磁盘的版本库模块。
  - 处理“file”方案

[root@localhost ~]#
View Code

 

Linux中查询SVN相关命令:svn help

[root@localhost ~]# svn help
用法: svn <subcommand> [options] [args]
Subversion 命令行客户端,版本 1.7.14。
使用“svn help <subcommand>” 显示子命令的帮助信息。
使用“svn --version”查看程序的版本号和版本库访问模块,或者
使用“svn --version --quiet”只查看程序的版本号。

大多数的子命令可接受文件或目录参数,对目录进行递归处理。
如果没有指定参数,默认对当前目录(包含当前目录)递归处理。

可用的子命令: 
   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)
   patch
   propdel (pdel, pd)
   propedit (pedit, pe)
   propget (pget, pg)
   proplist (plist, pl)
   propset (pset, ps)
   relocate
   resolve
   resolved
   revert
   status (stat, st)
   switch (sw)
   unlock
   update (up)
   upgrade

Subversion 是版本控制工具。
欲取得详细资料,请参阅 http://subversion.apache.org/
View Code

 

创建仓库:

创建SVN仓库目录:mkdir svnrepository(svnrepository是目录名,自定义)

创建SVN项目仓库:svnadmin create /root/svnrepository/mypro(svnrepository为空,mypro目录事先不存在)

[root@localhost ~]# mkdir svnrepository
[root@localhost ~]# ll
总用量 4
-rw-------. 1 root root 1437 2月  15 04:51 anaconda-ks.cfg
drwxr-xr-x. 2 root root    6 2月  28 20:58 svnrepository
[root@localhost ~]# pwd
/root
[root@localhost ~]# svnadmin create /root/svnrepository/mypro
[root@localhost ~]# ll
总用量 4
-rw-------. 1 root root 1437 2月  15 04:51 anaconda-ks.cfg
drwxr-xr-x. 3 root root   19 2月  28 21:00 svnrepository
[root@localhost ~]# cd svnrepository/
[root@localhost svnrepository]# ll
总用量 0
drwxr-xr-x. 6 root root 86 2月  28 21:00 mypro
[root@localhost svnrepository]# cd mypro/
[root@localhost mypro]# ll
总用量 8
drwxr-xr-x. 2 root root  54 2月  28 21:00 conf
drwxr-sr-x. 6 root root 233 2月  28 21:00 db
-r--r--r--. 1 root root   2 2月  28 21:00 format
drwxr-xr-x. 2 root root 231 2月  28 21:00 hooks
drwxr-xr-x. 2 root root  41 2月  28 21:00 locks
-rw-r--r--. 1 root root 229 2月  28 21:00 README.txt
View Code

 启动SVN服务:

对svnrepository目录管理:svnserve -d -r /root/svnrepository/ 说明:-d表示后台运行,-r表示目录递归,启动成功后会多一个3690的服务

若只想对其他目录管理则用:svnserve -d -r 目录绝对路径

[root@localhost mypro]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      986/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1245/master         
tcp6       0      0 :::22                   :::*                    LISTEN      986/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1245/master         
[root@localhost mypro]# svnserve -d -r /root/svnrepository/
[root@localhost mypro]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      11865/svnserve      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      986/sshd            
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1245/master         
tcp6       0      0 :::22                   :::*                    LISTEN      986/sshd            
tcp6       0      0 ::1:25                  :::*                    LISTEN      1245/master    
View Code

 

建立mypro目录和svnrepository取得联系:svn checkout svn://localhost/mypro

[root@localhost /]# ls
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
[root@localhost /]# ll
总用量 16
lrwxrwxrwx.   1 root root    7 2月  15 04:45 bin -> usr/bin
dr-xr-xr-x.   4 root root 4096 2月  15 04:53 boot
drwxr-xr-x.  20 root root 3200 2月  28 20:33 dev
drwxr-xr-x.  79 root root 8192 2月  28 20:42 etc
drwxr-xr-x.   3 root root   25 2月  15 04:50 home
lrwxrwxrwx.   1 root root    7 2月  15 04:45 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 2月  15 04:45 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 11月  5 2016 media
drwxr-xr-x.   2 root root    6 11月  5 2016 mnt
drwxr-xr-x.   2 root root    6 11月  5 2016 opt
dr-xr-xr-x. 106 root root    0 2月  28 20:33 proc
dr-xr-x---.   4 root root  175 2月  28 20:58 root
drwxr-xr-x.  23 root root  700 2月  28 20:42 run
lrwxrwxrwx.   1 root root    8 2月  15 04:45 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 11月  5 2016 srv
dr-xr-xr-x.  13 root root    0 2月  28 20:33 sys
drwxrwxrwt.   8 root root  173 2月  28 21:07 tmp
drwxr-xr-x.  13 root root  155 2月  15 04:45 usr
drwxr-xr-x.  19 root root  267 2月  28 20:33 var
[root@localhost /]# pwd
/
[root@localhost /]# svn checkout svn://localhost/mypro
取出版本 0。
[root@localhost /]# ll
总用量 16
lrwxrwxrwx.   1 root root    7 2月  15 04:45 bin -> usr/bin
dr-xr-xr-x.   4 root root 4096 2月  15 04:53 boot
drwxr-xr-x.  20 root root 3200 2月  28 20:33 dev
drwxr-xr-x.  79 root root 8192 2月  28 20:42 etc
drwxr-xr-x.   3 root root   25 2月  15 04:50 home
lrwxrwxrwx.   1 root root    7 2月  15 04:45 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 2月  15 04:45 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 11月  5 2016 media
drwxr-xr-x.   2 root root    6 11月  5 2016 mnt
drwxr-xr-x.   3 root root   18 2月  28 21:23 mypro
drwxr-xr-x.   2 root root    6 11月  5 2016 opt
dr-xr-xr-x. 106 root root    0 2月  28 20:33 proc
dr-xr-x---.   4 root root  175 2月  28 20:58 root
drwxr-xr-x.  23 root root  700 2月  28 20:42 run
lrwxrwxrwx.   1 root root    8 2月  15 04:45 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 11月  5 2016 srv
dr-xr-xr-x.  13 root root    0 2月  28 20:33 sys
drwxrwxrwt.   8 root root  173 2月  28 21:23 tmp
drwxr-xr-x.  13 root root  155 2月  15 04:45 usr
drwxr-xr-x.  19 root root  267 2月  28 20:33 var
[root@localhost /]# cd mypro/
[root@localhost mypro]# ll -a
总用量 0
drwxr-xr-x.  3 root root  18 2月  28 21:23 .
dr-xr-xr-x. 18 root root 237 2月  28 21:23 ..
drwxr-xr-x.  4 root root  75 2月  28 21:23 .svn
View Code

 创建文件,添加,提交

[root@localhost mypro]# ll
总用量 0
[root@localhost mypro]# vim hello.txt
-bash: vim: 未找到命令
[root@localhost mypro]# ll
总用量 0
[root@localhost mypro]# vi hello.txt
This is a txt file for SVN test.
这是为演示SVN创建的文件。
The end.
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"hello.txt" [New] 3L, 79C written
[root@localhost mypro]# svn add hello.txt 
A         hello.txt
[root@localhost mypro]# svn commit hello.txt 
svn: E205007: 提交失败(细节如下): 
svn: E205007: 无法使用外部编辑器获得日志信息;考虑设置环境变量 $SVN_EDITOR,或者使用 --message (-m) 或 --file (-F) 选项
svn: E205007: 没有设置 SVN_EDITOR,VISUAL 或 EDITOR 环境变量,运行时的配置参数中也没有 “editor-cmd” 选项
[root@localhost mypro]# svn commit -m '第一次提交First Commit' hello.txt 
svn: E170001: 提交失败(细节如下): 
svn: E170001: 认证失败
[root@localhost mypro]# ll
总用量 4
-rw-r--r--. 1 root root 79 2月  28 21:31 hello.txt
[root@localhost mypro]# cd conf/
-bash: cd: conf/: 没有那个文件或目录
[root@localhost mypro]# cd /root/svnrepository/
[root@localhost svnrepository]# ll
总用量 0
drwxr-xr-x. 6 root root 86 2月  28 21:00 mypro
[root@localhost svnrepository]# cd mypro/
[root@localhost mypro]# ll
总用量 8
drwxr-xr-x. 2 root root  54 2月  28 21:00 conf
drwxr-sr-x. 6 root root 233 2月  28 21:00 db
-r--r--r--. 1 root root   2 2月  28 21:00 format
drwxr-xr-x. 2 root root 231 2月  28 21:00 hooks
drwxr-xr-x. 2 root root  41 2月  28 21:00 locks
-rw-r--r--. 1 root root 229 2月  28 21:00 README.txt
[root@localhost mypro]# cd conf/
[root@localhost conf]# ll
总用量 12
-rw-r--r--. 1 root root 1080 2月  28 21:00 authz
-rw-r--r--. 1 root root  309 2月  28 21:00 passwd
-rw-r--r--. 1 root root 3090 2月  28 21:00 svnserve.conf
[root@localhost conf]# vi svnserve.conf 
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

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

[general]
### The anon-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 that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
anon-access = write 允许匿名用户写
# 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
"svnserve.conf" 61L, 3089C written
[root@localhost conf]# ls
authz  passwd  svnserve.conf
[root@localhost conf]# cd /
[root@localhost /]# ls
bin   dev  home  lib64  mnt    opt   root  sbin  sys  usr
boot  etc  lib   media  mypro  proc  run   srv   tmp  var
[root@localhost /]# cd mypro/
[root@localhost mypro]# ls
hello.txt
[root@localhost mypro]# svn commit -m '第一次提交First Commit' hello.txt 
正在增加       hello.txt
传输文件数据.
提交后的版本为 1。
[root@localhost mypro]# cd /root/svnrepository/
[root@localhost svnrepository]# ls
mypro
[root@localhost svnrepository]# cd mypro/
[root@localhost mypro]# ls
conf  db  format  hooks  locks  README.txt
[root@localhost mypro]# cd db
[root@localhost db]# ls
current  fsfs.conf  min-unpacked-rev  revprops  transactions  txn-current-lock  uuid
format   fs-type    rep-cache.db      revs      txn-current   txn-protorevs     write-lock
[root@localhost db]# cd revs
[root@localhost revs]# ls
0
[root@localhost revs]# cd 0
[root@localhost 0]# ll
总用量 8
-r--r--r--. 1 root root 115 2月  28 21:00 0
-r--r--r--. 1 root root 502 2月  28 21:38 1
[root@localhost 0]# vi 1
DELTA
SVN^A^@^@O^CP^B<80>OOThis is a txt file for SVN test.
è¿<99>æ<98>¯ä¸ºæ¼<94>示SVNå<88><9b>建ç<9a><84>æ<96><87>件ã<80><82>
The end.
ENDREP
id: 0-1.0.r1/105
type: file
count: 0
text: 1 0 92 79 1a729a1113bd2312950ef1fd24fb89aa ae798a3e24644a623ae2306fbcdb24e30b15c49b 0-0/_2
cpath: /hello.txt
copyroot: 0 /

PLAIN
K 9
hello.txt
V 17
file 0-1.0.r1/105
END
ENDREP
id: 0.0.r1/326
type: dir
pred: 0.0.r0/17
count: 1
text: 1 272 41 41 fcd6f1e9732e181d6fa1c740fcd3621e
cpath: /
copyroot: 0 /

_0.0.t0-0 add-file true false /hello.txt


"1" [readonly][converted] 31L, 536C

 

Windows中安装SVN服务端:和安装普通软件一样,没什么可讲,下一步下一步就好。安装完成后通过以下命令查看。

C:\Users\xiongjiawei>svn --version
svn, version 1.9.5 (r1770682)
   compiled Nov 26 2016, 14:22:31 on x86-microsoft-windows

Copyright (C) 2016 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository access (RA) modules are available:

* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - using serf 1.3.9 (compiled with 1.3.9)
  - handles 'http' scheme
  - handles 'https' scheme

The following authentication credential caches are available:

* Wincrypt cache in C:\Users\xiongjiawei\AppData\Roaming\Subversion


C:\Users\xiongjiawei>where svn
D:\Program Files\TortoiseSVN\bin\svn.exe
View Code

 Windows中安装SVN客户端:和安装普通软件一样,没什么可讲,下一步下一步就好。

安装完成后若右键菜单中无svn相关选项,尝试重启电脑解决,或任务管理器结束进程explorer.exe后再新建运行此进程。

Windows客户端检出SVN目录:

 

 连接失败:

 

 解决办法:关闭SVN服务器防火墙:

关闭防火墙方法一:/etc/init.d/iptables stop 若此法不行,参见方法二。

关闭防火墙方法二:

[root@localhost init.d]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 五 2020-02-28 20:33:21 CST; 1h 52min ago
     Docs: man:firewalld(1)
 Main PID: 663 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─663 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

2月 28 20:33:20 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewa....
2月 28 20:33:21 localhost.localdomain systemd[1]: Started firewalld - dynamic firewal....
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost init.d]# systemctl stop firewalld.service
[root@localhost init.d]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since 五 2020-02-28 22:26:51 CST; 8s ago
     Docs: man:firewalld(1)
 Main PID: 663 (code=exited, status=0/SUCCESS)

2月 28 20:33:20 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewa....
2月 28 20:33:21 localhost.localdomain systemd[1]: Started firewalld - dynamic firewal....
2月 28 22:26:50 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewa....
2月 28 22:26:51 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewal....
Hint: Some lines were ellipsized, use -l to show in full.

Linux服务端关闭防火墙后,windows客户端就成功check out了:

 客户端提交的文件或文件夹都提到服务器的/root/svnrepository/mypro/db/revs/0目录下了,1是第一次提交,2是第二次提交。

[root@localhost 0]# pwd
/root/svnrepository/mypro/db/revs/0
[root@localhost 0]# ll
总用量 12
-r--r--r--. 1 root root 115 2月  28 21:00 0
-r--r--r--. 1 root root 502 2月  28 21:38 1
-r--r--r--. 1 root root 313 2月  28 22:36 2

 Linux客户端更新:svn update

[root@localhost mypro]# svn update
正在升级 '.':
A    2
A    2/新建文本文档.txt
A    3
A    3/新建 RTF 文档.rtf
A    3/22.txt
A    abc
更新到版本 3。
[root@localhost mypro]# ll
总用量 4
drwxr-xr-x. 2 root root 36 2月  28 23:00 2
drwxr-xr-x. 2 root root 49 2月  28 23:00 3
drwxr-xr-x. 2 root root  6 2月  28 23:00 abc
-rw-r--r--. 1 root root 79 2月  28 21:31 hello.txt
[root@localhost mypro]# cd 2
[root@localhost 2]# ll
总用量 0
-rw-r--r--. 1 root root 0 2月  28 23:00 新建文本文档.txt
View Code

 windows客户端恢复误删文件:

右键-TortoiseSVN-Update to revision...-Show log,选择要回退到的版本,OK,OK

恢复文件后建议复制或剪切到其他地方,或重命名,否则直接Update还是会删除。

冲突的终极解决办法:删除.svn重新check out

 


 关闭匿名用户,启用账号密码

Last login: Fri Feb 28 23:22:58 2020
[root@localhost ~]# ls
anaconda-ks.cfg  svnrepository
[root@localhost ~]# cd svnrepository/
[root@localhost svnrepository]# ls
mypro
[root@localhost svnrepository]# cd mypro/
[root@localhost mypro]# ls
conf  db  format  hooks  locks  README.txt
[root@localhost mypro]# cd conf/
[root@localhost conf]# ls
authz  passwd  svnserve.conf
[root@localhost conf]# ll
总用量 12
-rw-r--r--. 1 root root 1080 2月  28 21:00 authz
-rw-r--r--. 1 root root  309 2月  28 21:00 passwd
-rw-r--r--. 1 root root 3089 2月  28 21:38 svnserve.conf
[root@localhost conf]# vi svnserve.conf 
### Uncomment the line below to use the default password file.
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

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

[general]
### The anon-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 that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
# anon-access = write  关闭匿名用户anonymous,anonymity
# 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.
"svnserve.conf" 61L, 3087C written

再提交就会提示输入用户名密码:

 添加账号密码:

[root@localhost conf]# ll
总用量 12
-rw-r--r--. 1 root root 1080 2月  28 21:00 authz
-rw-r--r--. 1 root root  309 2月  28 21:00 passwd
-rw-r--r--. 1 root root 3087 2月  28 23:46 svnserve.conf
[root@localhost conf]# vi 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 = sallyssecret
xiongjiawei = 9527  添加一个用户xiongjiawei密码9527
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"passwd" 9L, 328C written
[root@localhost conf]# vi authz
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[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,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =  其他人

# [repository:/baz/fuz]
# @harry_and_sally = rw  分组
# * = r

[mypro:/]  对mypro仓库所有目录/
xiongjiawei = rw  对用户xiongjiawei赋予读写权限
"authz" 35L, 1108C written

 


 

 钩子的使用:

创建配置仓库:步骤同上

[root@localhost svnrepository]# ls
mypro
[root@localhost svnrepository]# pwd
/root/svnrepository
[root@localhost svnrepository]# svnadmin create /root/svnrepository/gouzi
[root@localhost svnrepository]# ll
总用量 0
drwxr-xr-x. 6 root root 86 2月  29 00:31 gouzi
drwxr-xr-x. 6 root root 86 2月  28 21:00 mypro
[root@localhost svnrepository]# cd gouzi/
[root@localhost gouzi]# ls
conf  db  format  hooks  locks  README.txt
[root@localhost gouzi]# cd conf/
[root@localhost conf]# ll
总用量 12
-rw-r--r--. 1 root root 1080 2月  29 00:31 authz
-rw-r--r--. 1 root root  309 2月  29 00:31 passwd
-rw-r--r--. 1 root root 3090 2月  29 00:31 svnserve.conf
[root@localhost conf]# vi svnserve.conf 
### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

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

[general]
### The anon-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 that anonymous
### 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.
"svnserve.conf" 61L, 3086C written
[root@localhost conf]# vi 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 = sallyssecret
xiong = xiong
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"passwd" 9L, 323C written
[root@localhost conf]# vi authz 
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[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,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

[gouzi:/]
xiong = rw
"authz" 35L, 1102C written
[root@localhost conf]# 
View Code

 windows客户端check out:

 

 

 

 

在服务器上创建一个自动同步的目录:

[root@localhost /]# cd root
[root@localhost ~]# ls
anaconda-ks.cfg  svnrepository
[root@localhost ~]# mkdir www
[root@localhost ~]# ls
anaconda-ks.cfg  svnrepository  www
[root@localhost ~]# cd www
[root@localhost www]# ls
[root@localhost www]# svn co svn://127.0.0.1/gouzi  co是check out的简写
认证领域: <svn://127.0.0.1:3690> dd5216b7-47f5-4872-a853-3c3a663ff50a
“root”的密码: 
认证领域: <svn://127.0.0.1:3690> dd5216b7-47f5-4872-a853-3c3a663ff50a
用户名: 

可以看到windows客户端上提交的index.html成功check out到服务器自动同步的目录中了:

[root@localhost www]# ls
gouzi
[root@localhost www]# cd ..
[root@localhost ~]# ls
anaconda-ks.cfg  svnrepository  www
[root@localhost ~]# cd svnrepository/
[root@localhost svnrepository]# ls
gouzi  mypro
[root@localhost svnrepository]# cd ../www/
[root@localhost www]# ls
gouzi
[root@localhost www]# cd gouzi/
[root@localhost gouzi]# ls
index.html    Linux服务器上自动同步的目录

windows客户端截图:

 

 设置钩子:

Last login: Fri Feb 28 23:43:30 2020 from 192.168.133.1
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd svnrepository/gouzi/hooks/
[root@localhost hooks]# ll
总用量 36
-rw-r--r--. 1 root root 1977 2月  29 00:31 post-commit.tmpl
-rw-r--r--. 1 root root 1638 2月  29 00:31 post-lock.tmpl
-rw-r--r--. 1 root root 2289 2月  29 00:31 post-revprop-change.tmpl
-rw-r--r--. 1 root root 1567 2月  29 00:31 post-unlock.tmpl
-rw-r--r--. 1 root root 3426 2月  29 00:31 pre-commit.tmpl
-rw-r--r--. 1 root root 2434 2月  29 00:31 pre-lock.tmpl
-rw-r--r--. 1 root root 2786 2月  29 00:31 pre-revprop-change.tmpl
-rw-r--r--. 1 root root 2122 2月  29 00:31 pre-unlock.tmpl
-rw-r--r--. 1 root root 2780 2月  29 00:31 start-commit.tmpl
[root@localhost hooks]# cp post-commit.tmpl post-commit
[root@localhost hooks]# chmod +x post-commit
[root@localhost hooks]# ll
总用量 40
-rwxr-xr-x. 1 root root 1977 2月  29 00:57 post-commit
-rw-r--r--. 1 root root 1977 2月  29 00:31 post-commit.tmpl
-rw-r--r--. 1 root root 1638 2月  29 00:31 post-lock.tmpl
-rw-r--r--. 1 root root 2289 2月  29 00:31 post-revprop-change.tmpl
-rw-r--r--. 1 root root 1567 2月  29 00:31 post-unlock.tmpl
-rw-r--r--. 1 root root 3426 2月  29 00:31 pre-commit.tmpl
-rw-r--r--. 1 root root 2434 2月  29 00:31 pre-lock.tmpl
-rw-r--r--. 1 root root 2786 2月  29 00:31 pre-revprop-change.tmpl
-rw-r--r--. 1 root root 2122 2月  29 00:31 pre-unlock.tmpl
-rw-r--r--. 1 root root 2780 2月  29 00:31 start-commit.tmpl
[root@localhost hooks]# vi post-commit

删除原文件所有注释内容,添加两行:

export LANG=en_US.UTF-8
/usr/bin/svn update /root/www/gouzi --username xiong --password xiong

Last login: Sat Feb 29 01:01:00 2020 from 192.168.133.1
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd svnrepository/gouzi/hooks/
[root@localhost hooks]# ll
总用量 40
-rwxr-xr-x. 1 root root 2070 2月  29 01:06 post-commit
-rw-r--r--. 1 root root 1977 2月  29 00:31 post-commit.tmpl
-rw-r--r--. 1 root root 1638 2月  29 00:31 post-lock.tmpl
-rw-r--r--. 1 root root 2289 2月  29 00:31 post-revprop-change.tmpl
-rw-r--r--. 1 root root 1567 2月  29 00:31 post-unlock.tmpl
-rw-r--r--. 1 root root 3426 2月  29 00:31 pre-commit.tmpl
-rw-r--r--. 1 root root 2434 2月  29 00:31 pre-lock.tmpl
-rw-r--r--. 1 root root 2786 2月  29 00:31 pre-revprop-change.tmpl
-rw-r--r--. 1 root root 2122 2月  29 00:31 pre-unlock.tmpl
-rw-r--r--. 1 root root 2780 2月  29 00:31 start-commit.tmpl
[root@localhost hooks]# vi post-commit
# POST-COMMIT HOOK
#
# The post-commit hook is invoked after a commit.  Subversion runs
# this hook by invoking a program (script, executable, binary, etc.)
# named 'post-commit' (for which this file is a template) with the
# following ordered arguments:
#
#   [1] REPOS-PATH   (the path to this repository)
#   [2] REV          (the number of the revision just committed)
#
# The default working directory for the invocation is undefined, so
# the program should set one explicitly if it cares.
#
# Because the commit has already completed and cannot be undone,
# the exit code of the hook program is ignored.  The hook program
# can use the 'svnlook' utility to help it examine the
# newly-committed tree.
#
# On a Unix system, the normal procedure is to have 'post-commit'
# invoke other programs to do the real work, though it may do the
# work itself too.
#
# Note that 'post-commit' must be executable by the user(s) who will
# invoke it (typically the user httpd runs as), and that user must
# have filesystem-level permission to access the repository.
#
# On a Windows system, you should name the hook program
# 'post-commit.bat' or 'post-commit.exe',
# but the basic idea is the same.
#
# The hook program typically does not inherit the environment of
# its parent process.  For example, a common problem is for the
# PATH environment variable to not be set to its usual value, so
# that subprograms fail to launch unless invoked via absolute path.
# If you're having unexpected problems with a hook program, the
# culprit may be unusual (or missing) environment variables.
#
# Here is an example hook script, for a Unix /bin/sh interpreter.
# For more examples and pre-written hooks, see those in
# the Subversion repository at
# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/


REPOS="$1"
REV="$2"

#!/bin/sh
export LANG=en_US.UTF-8
/usr/bin/svn update /root/www/gouzi --username xiong --password xiong
~
~
"post-commit" 3L, 104C written
[root@localhost hooks]# cd /root/www/gouzi
[root@localhost gouzi]# ls
index.html

在Windows客户端添加新内容:

 

 查看服务器端自动同步目录:

[root@localhost gouzi]# ls
index.html  服务器端设置好钩子后在Windows客户端提交.txt

……

posted @ 2020-02-28 20:33  xiongjiawei  阅读(567)  评论(0编辑  收藏  举报