阿里云ECS搭建SVN

SVN 的一些概念

  • repository(源代码库):源代码统一存放的地方
  • Checkout(提取):当手上没有源代码时,需要从repository checkout一份源代码
  • Commit(提交):如果已经修改了代码,需要Commit到repository
  • Update(更新):当已经Checkout了一份源代码,Update一下,就可以与Repository上的源代码同步,手上的代码就会有最新的变

ECS

SSH连接,查看,这个ECS系统比较老

[root@Web ~]# lsb_release -a
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID:    CentOS
Description:    CentOS release 6.8 (Final)
Release:    6.8
Codename:    Final

先用yum

yum install subversion
svnserve --version  #查看版本
[root@Web ~]# svnserve --version
svnserve,版本 1.6.11 (r934486)
   编译于 Aug 17 2015,08:37:43

版权所有 (C) 2000-2009 CollabNet。
Subversion 是开放源代码软件,请参阅 http://subversion.tigris.org/ 站点。
此产品包含由 CollabNet(http://www.Collab.Net/) 开发的软件。

下列版本库后端(FS) 模块可用:

* fs_base : 模块只能操作BDB版本库。
* fs_fs : 模块与文本文件(FSFS)版本库一起工作。

Cyrus SASL 认证可用。


创建版本库

mkdir /var/svn

cd进去,创建版本库

cd /var/svn
svnadmin create /var/svn/svnrepos
[root@Web svnrepos]# ls
conf  db  format  hooks  locks  README.txt
[root@Web svnrepos]# pwd
/var/svn/svnrepos
  1. Subversion目录说明:

  2. db目录:所有版本控制的数据存放文件。
  3. hooks目录:放置hook脚本文件的目录。
  4. locks目录:用来追踪存取文件库的客户端。
  5. format文件:是一个文本文件,里面只放了一个整数,表示当前文件库配置的版本号。
  6. conf目录:是这个仓库的配置文件(仓库的用户访问账号、权限等)。
  7. 运行命令 cd conf/ 进入conf目录(该SVN版本库配置文件)。返回结果如下:
  8. authz:是权限控制文件。
  9. passwd:是账号密码文件。
  10. svnserve.conf:SVN服务配置文件。

切到conf文件,编辑passwd文件在最后一行添加账户名

username = userpass  #等号前后有空格

编辑authz 按大G末行按o下一行编辑

[/]
username=rw  #权限

编辑svnrepos.conf

anon-access = read        #匿名用户可读,也可以设置 anon-access = none,不允许匿名用户访问。设置为 none,可以使日志日期正常显示
auth-access = write       #授权用户可写
password-db = passwd      #使用哪个文件作为账号文件
authz-db = authz          #使用哪个文件作为权限文件
realm = /var/svn/svnrepos #认证空间名,版本库所在目录
 1 ### This file controls the configuration of the svnserve daemon, if you
 2 ### use it to allow access to this repository.  (If you only allow
 3 ### access through http: and/or file: URLs, then this file is
 4 ### irrelevant.)
 5 
 6 ### Visit http://subversion.tigris.org/ for more information.
 7 
 8 [general]
 9 ### These options control access to the repository for unauthenticated
10 ### and authenticated users.  Valid values are "write", "read",
11 ### and "none".  The sample settings below are the defaults.
12 anon-access = read
13 auth-access = write
14 ### The password-db option controls the location of the password
15 ### database file.  Unless you specify a path starting with a /,
16 ### the file's location is relative to the directory containing
17 ### this configuration file.
18 ### If SASL is enabled (see below), this file will NOT be used.
19 ### Uncomment the line below to use the default password file.
20 password-db = passwd
21 ### The authz-db option controls the location of the authorization
22 ### rules for path-based access control.  Unless you specify a path
23 ### starting with a /, the file's location is relative to the the
24 ### directory containing this file.  If you don't specify an
25 ### authz-db, no path-based access control is done.
26 ### Uncomment the line below to use the default authorization file.
27 authz-db = authz
28 ### This option specifies the authentication realm of the repository.
29 ### If two repositories have the same authentication realm, they should
30 ### have the same password database, and vice versa.  The default realm
31 ### is repository's uuid.
32 realm = /var/svn/svnrepos
33 
34 [sasl]
35 ### This option specifies whether you want to use the Cyrus SASL
36 ### library for authentication. Default is false.
37 ### This section will be ignored if svnserve is not built with Cyrus
38 ### SASL support; to check, run 'svnserve --version' and look for a line
39 ### reading 'Cyrus SASL authentication is available.'
40 # use-sasl = true
41 ### These options specify the desired strength of the security layer
42 ### that you want SASL to provide. 0 means no encryption, 1 means
43 ### integrity-checking only, values larger than 1 are correlated
44 ### to the effective key length for encryption (e.g. 128 means 128-bit
45 ### encryption). The values below are the defaults.
46 # min-encryption = 0
47 # max-encryption = 256
View Code

启动SVN

svnserve -d -r /var/svn/svnrepos
[root@Web conf]# svnserve -d -r /var/svn/svnrepos
[root@Web conf]# netstat -anpt | grep svn
tcp        0      0 0.0.0.0:3690                0.0.0.0:*                   LISTEN      19865/svnserve      
[root@Test-server svnrepos]# !443
netstat -anpt | grep svn
tcp        0      0 0.0.0.0:3690            0.0.0.0:*               LISTEN      9271/svnserve       

关掉SVN是kill

killall -9 svnserve

然后需要去阿里亚ECS管理控制台---添加安全组规则中开放3690端口

 

SVNwindows使用

定资源库URL,格式为 svn://实例公网IP地址/资源库名;指定 检出至目录

 

posted @ 2019-03-19 14:53  Cheney&  阅读(256)  评论(0编辑  收藏  举报