腾讯云服务器从购买到使用-第四章-SVN服务搭建

卸载

  1. 查询之前有没有安装svn。
    [root@VM_0_9_centos ~]# rpm -qa subversion
    [root@VM_0_9_centos ~]# 

    如上则没安装。

  2. 如果安装了则卸载。
    [root@VM_0_9_centos ~]# yum removesubversion

     

开始安装

  1. 云安装 安装SVN相关服务 。
    [root@VM_0_9_centos /]# yum -y install subversion
    Loaded plugins: fastestmirror, langpacks
    Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
    epel                                                                                                                                                | 5.3 kB  00:00:00     
    extras                                                                                                                                              | 3.4 kB  00:00:00     
    mysql-connectors-community                                                                                                                          | 2.5 kB  00:00:00     
    mysql-tools-community                                                                                                                               | 2.5 kB  00:00:00     
    mysql57-community                                                                                                                                   | 2.5 kB  00:00:00     
    os                                                                                                                                                  | 3.6 kB  00:00:00     
    updates                                                                                                                                             | 3.4 kB  00:00:00     
    (1/7): epel/7/x86_64/updateinfo                                                                                                                     | 994 kB  00:00:00     
    (2/7): extras/7/x86_64/primary_db                                                                                                                   | 215 kB  00:00:01     
    (3/7): epel/7/x86_64/primary_db                                                                                                                     | 6.8 MB  00:00:01     
    (4/7): updates/7/x86_64/primary_db                                                                                                                  | 7.4 MB  00:00:00     
    (5/7): mysql57-community/x86_64/primary_db                                                                                                          | 184 kB  00:00:01     
    (6/7): mysql-connectors-community/x86_64/primary_db                                                                                                 |  44 kB  00:00:03     
    (7/7): mysql-tools-community/x86_64/primary_db                                                                                                      |  61 kB  00:00:12     
    Determining fastest mirrors
    Resolving Dependencies
    --> Running transaction check
    ---> Package subversion.x86_64 0:1.7.14-14.el7 will be installed
    --> Processing Dependency: subversion-libs(x86-64) = 1.7.14-14.el7 for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_wc-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_subr-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_repos-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_ra_svn-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_ra_neon-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_ra_local-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_ra-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_fs_util-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_fs_fs-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_fs_base-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_fs-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_diff-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_delta-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libsvn_client-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libneon.so.27()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Processing Dependency: libapr-1.so.0()(64bit) for package: subversion-1.7.14-14.el7.x86_64
    --> Running transaction check
    ---> Package apr.x86_64 0:1.4.8-3.el7_4.1 will be installed
    ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
    ---> Package neon.x86_64 0:0.30.0-3.el7 will be installed
    --> Processing Dependency: libpakchois.so.0()(64bit) for package: neon-0.30.0-3.el7.x86_64
    ---> Package subversion-libs.x86_64 0:1.7.14-14.el7 will be installed
    --> Running transaction check
    ---> Package pakchois.x86_64 0:0.4-10.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ===========================================================================================================================================================================
     Package                                       Arch                                 Version                                         Repository                        Size
    ===========================================================================================================================================================================
    Installing:
     subversion                                    x86_64                               1.7.14-14.el7                                   os                               1.0 M
    Installing for dependencies:
     apr                                           x86_64                               1.4.8-3.el7_4.1                                 os                               103 k
     apr-util                                      x86_64                               1.5.2-6.el7                                     os                                92 k
     neon                                          x86_64                               0.30.0-3.el7                                    os                               165 k
     pakchois                                      x86_64                               0.4-10.el7                                      os                                14 k
     subversion-libs                               x86_64                               1.7.14-14.el7                                   os                               922 k
    
    Transaction Summary
    ===========================================================================================================================================================================
    Install  1 Package (+5 Dependent packages)
    
    Total download size: 2.3 M
    Installed size: 8.1 M
    Downloading packages:
    (1/6): apr-util-1.5.2-6.el7.x86_64.rpm                                                                                                              |  92 kB  00:00:00     
    (2/6): apr-1.4.8-3.el7_4.1.x86_64.rpm                                                                                                               | 103 kB  00:00:00     
    (3/6): neon-0.30.0-3.el7.x86_64.rpm                                                                                                                 | 165 kB  00:00:00     
    (4/6): pakchois-0.4-10.el7.x86_64.rpm                                                                                                               |  14 kB  00:00:00     
    (5/6): subversion-libs-1.7.14-14.el7.x86_64.rpm                                                                                                     | 922 kB  00:00:00     
    (6/6): subversion-1.7.14-14.el7.x86_64.rpm                                                                                                          | 1.0 MB  00:00:00     
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                       10 MB/s | 2.3 MB  00:00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : apr-1.4.8-3.el7_4.1.x86_64                                                                                                                              1/6 
      Installing : apr-util-1.5.2-6.el7.x86_64                                                                                                                             2/6 
      Installing : pakchois-0.4-10.el7.x86_64                                                                                                                              3/6 
      Installing : neon-0.30.0-3.el7.x86_64                                                                                                                                4/6 
      Installing : subversion-libs-1.7.14-14.el7.x86_64                                                                                                                    5/6 
      Installing : subversion-1.7.14-14.el7.x86_64                                                                                                                         6/6 
      Verifying  : neon-0.30.0-3.el7.x86_64                                                                                                                                1/6 
      Verifying  : subversion-1.7.14-14.el7.x86_64                                                                                                                         2/6 
      Verifying  : subversion-libs-1.7.14-14.el7.x86_64                                                                                                                    3/6 
      Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                                                             4/6 
      Verifying  : pakchois-0.4-10.el7.x86_64                                                                                                                              5/6 
      Verifying  : apr-1.4.8-3.el7_4.1.x86_64                                                                                                                              6/6 
    
    Installed:
      subversion.x86_64 0:1.7.14-14.el7                                                                                                                                        
    
    Dependency Installed:
      apr.x86_64 0:1.4.8-3.el7_4.1    apr-util.x86_64 0:1.5.2-6.el7    neon.x86_64 0:0.30.0-3.el7    pakchois.x86_64 0:0.4-10.el7    subversion-libs.x86_64 0:1.7.14-14.el7   
    
    Complete!
    [root@VM_0_9_centos /]# 

    再此执行命令rpm -qa subversion

    [root@VM_0_9_centos /]# rpm -qa subversion
    subversion-1.7.14-14.el7.x86_64
    [root@VM_0_9_centos /]# 

    如上说明安装了svn。

建立svn版本库

          原因:CentOS 7 默认不对外开放3690端口。 

  1. mkdir /var/svn/svnrepos 创建一个文件夹。
  2. 创建SVN版本库   svnadmin create /var/svn/svnrepos/xxxx    (xxxx)为目录(项目或版本库)名称,后面checkout项目时会用到。
    [root@VM_0_9_centos svn]# svnadmin create /var/svn/svnrepos/zzh
    [root@VM_0_9_centos svn]# 

     

  3. 进入该目录查看目录下检查创建的文件。

    [root@VM_0_9_centos zzh]# cd /var/svn/svnrepos/zzh
    [root@VM_0_9_centos zzh]# ll
    total 24
    drwxr-xr-x 2 root root 4096 Aug 14 11:31 conf
    drwxr-sr-x 6 root root 4096 Aug 14 11:31 db
    -r--r--r-- 1 root root    2 Aug 14 11:31 format
    drwxr-xr-x 2 root root 4096 Aug 14 11:31 hooks
    drwxr-xr-x 2 root root 4096 Aug 14 11:31 locks
    -rw-r--r-- 1 root root  229 Aug 14 11:31 README.txt
    [root@VM_0_9_centos zzh]# 

    conf,db,format,books,locks等文件或文件夹。

    conf:SVN版本库配置文件(帐号密码权限等)

    conf/authz:负责账号权限的管理,控制账号是否读写权限

    conf/passwd:负责账号和密码的用户名单管理

    conf/svnserve.conf:svn服务器配置文件

    db:版本库数据存储

    locks:跟踪目录的访问者
     

  4. 修改配置文件。

    进入conf目录,修改authz文件,按一下 i 键 进入VIM编辑模式。

    [root@VM_0_9_centos zzh]# cd conf/
    [root@VM_0_9_centos conf]# ll
    total 12
    -rw-r--r-- 1 root root 1080 Aug 14 11:31 authz
    -rw-r--r-- 1 root root  309 Aug 14 11:31 passwd
    -rw-r--r-- 1 root root 3090 Aug 14 11:31 svnserve.conf
    [root@VM_0_9_centos conf]# vi authz 

     

  5. 在本文末尾增加如下代码:

    [/]    

    用户名1 = rw

    用户名2 = r

    * = r

    [/文件夹1]

    用户名2 = rw

    PS:1:[/] 表示 最大权限   [/文件夹] 表示针对这个文件夹的权限

         2:用户名(组)可以随意定义

         3:rw 和 r分别代表  可读可写 和 只读

         4:* 表示 任何用户

         5:关于权限这边不做过多说明。

    ......
    [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
    [/]
    zhuzh = rw
    * = r

     

  6. 修改passwd 文件配置  在末尾添加 账号密码。

    格式是 :  账号 = 密码
    ......
    [users]
    # harry = harryssecret
    # sally = sallyssecret
    zhuzh = xxxx
    ~
    ~
    ~
    ~
    ~
    ~
    ~

     

  7. 修改svn配置文件vnserve.conf。

    ......
    ### "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.
    ### If two repositories have the same authentication realm, they should
    ### have the same password database, and vice versa.  The default realm
    ### is repository's uuid.
    realm = /var/svn/repositories
    ### The force-username-case option causes svnserve to case-normalize
    ### usernames before comparing them against the authorization rules in the
    ### authz-db file configured above.  Valid values are "upper" (to upper-
    ### case the usernames), "lower" (to lowercase the usernames), and
    ......

    取值范围介绍:write 可读可写  read 只读  none 无权访问

    anon-access:表示非授权(游客)用户访问范围 默认值:read;

    auth-access: 表示授权用户访问范围  默认值:write;

    password-db:passwd文件相对路径    他默认会指向你的 ../conf/passwd 不需要设置

    realm:# 认证空间名,版本库所在目录 比如:/var/svn/repositories

    去掉这4行的注释。
  8. 启动svn服务。同时查看服务是否启动。
    [root@VM_0_9_centos proname]# svnserve -d -r /var/svn/proname --listen-port=3690
    [root@VM_0_9_centos proname]# ps -ef | grep svn
    root      4117     1  0 17:30 ?        00:00:00 svnserve -d -r /var/svn/proname --listen-port=3690
    root      4131  2697  0 17:30 pts/0    00:00:00 grep --color=auto svn

    如上说明服务已启动。

  9. 在Windows用TorwoiseSVN测试。

  10. 如果出现此异常------svn: E000113: Unable to connect to a repository at URL 'svn://IP/repos'无法连接主机“IP”: 由于连接方在一段时间后没有正确答复。

        解决方案:

        centos7 设置防火墙:

       1.开放3690端口:

   firewall-cmd –permanent –zone=public –add-port=3690/tcp

       2.重启防火墙:

       firewall-cmd –reload

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值