zoukankan      html  css  js  c++  java
  • Mac svn使用学习-2-服务端

    2.在mac环境下搭建一个SVN服务器环境

    1)创建一个名为myCode的仓库——svnadmin命令

    格式:

    svnadmin SUBCOMMAND REPOS_PATH  [ARGS & OPTIONS ...]

    svnadmin是Subversion存储库管理工具

     

    首先就是在本地/Users/user的目录下创建一个名为mySVN的文件夹,然后就能够在这个文件夹中创建多个目录仓库

    比如要创建一个名为myCode的仓库,执行语句为:

    userdeMBP:~ user$ svnadmin create /Users/user/mySVN/myCode

    然后mySVN文件夹下就生成了myCode,其目录结构为:

    2)配置mySVN的用户权限

    即修改/Users/user/mySVN/myCode/conf目录下的三个文件

    1》svnserve.conf文件

    # anon-access = read #匿名用户可读
    # auth-access = write #授权用户可写
    
    # password-db = passwd #使用哪个文件(即passwd文件)作为账号文件。由于同在一个目录路径下,所以这里不用全路径
    
    # authz-db = authz #使用哪个文件作为权限文件

    将上面的四个配置项前面的#号和空格去掉

    anon-access = read代表匿名访问的时候是只读的,若改为anon-access = none代表禁止匿名访问,需要帐号密码才能访问

    2》passwd文件

    设置账户名和密码

    [users]
    # harry = harryssecret
    # sally = sallyssecret
    boss = 00000

    添加boss = 00000,boss为账户名,00000为密码

    3》authz文件

    配置用户组和权限

    我们可以将在passwd里添加的用户分配到不同的用户组里,这样以后就可以对不同用户组设置不同的权限,没有必要对每个用户进行单独设置权限。

    1> 在[groups]下面添加组名和用户名,如果有多个用户之间用逗号(,)隔开

    [groups]
    # harry_and_sally = harry,sally
    # harry_sally_and_joe = harry,sally,&joe
    topGroup = boss

    说明boss账户被分配到topGroup这个组中

    2> [/]代表svn服务器中的所有资源库

    [/]
    @topGroup = rw

    表示topGroup这个组中的所有用户对所有资源库都有读写(rw)权限,组名前面要用@

    如果只是设置某个用户可以写成,不用@:

    [/]
    boss = rw

    资源也可以写的很细,比如:

    [/foo/bar]
    [repository:/baz/fuz]

    3> 别名

    [aliases] #将boss账户的别名设置为joe
    joe = boss
    
    [/test] #然后让其对/test的权限为可读,使用别名需使用&
    &joe = r 

    4> *

    [repository:/baz/fuz]
    * = r #代表所有人对该资源都有读权限

    5> $authenticated

    所有经过身份验证的用户,使用“$authenticated”表示

    6>$anonymous

     匿名用户使用“$anonymous”表示

    3)启动svn服务器——svnserve命令

    格式:

    svnserve [-d | -i | -t | -X] [options]

    Subversion存储库服务器

    选项:

    Valid options:
      -d [--daemon]            : daemon mode   守护进程模式,将会启动服务作为一个独立的端口监控进程运行在后台。
                                  可以使用--listen-port=和--listen-host=参数来自定义需要的端口和主机名称。当前模式默认的端口是3690
      -i [--inetd]             : inetd mode    端口监控模式,用端口监控来启动处理客户的访问请求的进程。
                                  当使用-i参数启动服务的时候,svnserve服务 通过stdin和stdout用自定义协议和客户端通讯。同时服务侦听3690端口。
      -t [--tunnel]            : tunnel mode   隧道模式,这个模式要求远程服务程序,如RSH或SSH,已经成功验证用户,并且使用已经校验的用户启动一个属于该用户的svnserve进程。
                                  当使用该模式提供服务时,要确认启动的用户帐户具备对Repository的读/写权限。
      -X [--listen-once]       : listen-once mode (useful for debugging)   仅监听模式(在调试时有用)
      -r [--root] ARG          : root of directory to serve   要服务的目录的根目录
      -R [--read-only]         : force read only, overriding repository config file  强制只读,覆盖存储库配置文件
      --config-file ARG        : read configuration from file ARG  从文件ARG中读取配置信息
      --listen-port ARG        : listen port. The default port is 3690.[mode: daemon, listen-once]  监听端口,默认为3690[模式为daemon时使用,仅监听]
      --listen-host ARG        : listen hostname or IP address By default svnserve listens on all addresses.[mode: daemon, listen-once]
                                  监听主机名或IP地址,默认情况下svnservice监听所有地址[模式为daemon时使用,仅监听]
      -6 [--prefer-ipv6]       : prefer IPv6 when resolving the listen hostname    在解析监听主机名时首选IPv6
                                  [IPv4 is preferred by default.                     默认首选IPv4
                                   Using IPv4 and IPv6 at the same time is not supported in daemon mode. 在守护模式下不支持同时使用IPv4和IPv6。
                                 Use inetd mode or tunnel mode if you need this.]  如果你需要使用这个参数,请选择使用inetd或tunnel模式
      -c [--compression] ARG   : compression level to use for network transmissions [0 .. no compression, 5 .. default,9 .. maximum compression]
                                  用于网络传输的压缩级别[0 ..不压缩,5 ..默认级别,9 ..最大压缩]
      -M [--memory-cache-size] ARG : size of the extra in-memory cache in MB used to minimize redundant operations.
                                 Default is 16.0 switches to dynamically sized caches.[used for FSFS and FSX repositories only]
                                 用于最小化冗余操作的额外内存缓存(以MB为单位)的大小
                                 默认是16.0切换到动态大小的缓存。[只适用于FSFS及FSX存储库]
      --cache-txdeltas ARG     : enable or disable caching of deltas between older revisions. 启用或禁用旧版本之间的增量缓存
                                 Default is yes.                                                默认是启用的
                                 [used for FSFS and FSX repositories only]                    仅用于FSFS和FSX存储库
      --cache-fulltexts ARG    : enable or disable caching of file contents   启用或禁用文件内容缓存
                                 Default is yes.                               默认是启用的
                                 [used for FSFS and FSX repositories only]    仅用于FSFS和FSX存储库
      --cache-revprops ARG     : enable or disable caching of revision properties.  启用或禁用修订属性的缓存
                                 Consult the documentation before activating this.  在激活它之前,请参阅文档
                                 Default is no.                                      默认是禁用的
                                 [used for FSFS and FSX repositories only]          仅用于FSFS和FSX存储库
      --cache-nodeprops ARG    : enable or disable caching of node properties  启用或禁用节点属性的缓存
                                 Default is yes.                               默认是启用的
                                 [used for FSFS repositories only]             仅用于FSFS存储库
      --client-speed ARG       : Optimize network handling based on the assumption that most clients are connected with a bitrate of ARG Mbit/s.
                                 Default is 0 (optimizations disabled).
                                 假设大多数客户端以ARG Mbit/s的比特率连接,优化网络处理。
                                 默认值为0(禁用优化)
      --block-read ARG         : Parse and cache all data found in block instead of just the requested item. 解析和缓存在块中找到的所有数据,而不仅仅是请求的项。
                                 Default is no.                                                              默认是禁用的
                                 [used for FSFS repositories in 1.9 format only]                             只适用于1.9格式的FSFS存储库
      -T [--threads]           : use threads instead of fork [mode: daemon]       使用线程而不是分叉[模式:守护进程]
      --min-threads ARG        : Minimum number of server threads, even if idle.  服务器线程的最小数量,即使是空闲的。
                                 Capped to max-threads; minimum value is 0.       max-threads封顶;最小值是0。
                                 Default is 1.                                    默认为1
                                 [used only with --threads]                       仅与--threads参数一起使用
      --max-threads ARG        : Maximum number of server threads, even if there are more connections.   服务器线程的最大数量,即使有更多的连接
                                   Minimum value is 1.                                                     最小值为1
                                 Default is 256.                                                         默认为256
                                 [used only with --threads]                                                 仅与--threads参数一起使用
      --max-request-size ARG   : Maximum acceptable size of a client request in MB. 客户端请求的最大可接受大小(MB为单位)
                                 This implicitly limits the length of paths and property values that can be sent to the server.
                                 这隐式地限制了可以发送到服务器的路径和属性值的长度
                                 Also the peak memory usage for protocol handling per server thread or sub-process.
                                 和每个服务器线程或子进程的协议处理的内存使用峰值。
                                 0 disables the size check;  如果设置值为0,则禁用该大小检查
                                 default is 16.              默认值为16
      --max-response-size ARG  : Maximum acceptable server response size in MB. 最大可接受的服务器响应大小(以MB为单位)。
                                 Longer responses get truncated and return an error.  较长的响应将被截断并返回错误。
                                 This limits the server load e.g. when checking out at the wrong path level.这限制了服务器负载,例如在错误的路径级别签出时
                                 Default is 0 (disabled).                             默认设置为0(即禁用)
      --foreground             : run in foreground (useful for debugging)[mode: daemon] 在前台运行(用于调试)[mode: daemon]
      --single-thread          : handle one connection at a time in the parent process (useful for debugging) 在父进程中每次处理一个连接(用于调试)
      --log-file ARG           : svnserve log file          svnserve日志文件
      --pid-file ARG           : write server process ID to file ARG[mode: daemon, listen-once]   将服务器进程ID写入文件ARG[模式为daemon时使用,仅监听]
      --tunnel-user ARG        : tunnel username (default is current uid's name)[mode: tunnel]    隧道用户名(默认为当前uid的名称)[模式为tunnel时使用]
      -h [--help]              : display this help    显示帮助信息
      --virtual-host           : virtual host mode (look for repo in directory of provided hostname)  虚拟主机模式(在提供主机名的目录中查找repo)
      --version                : show program version information  显示项目的版本信息
      -q [--quiet]             : no progress (only errors) to stderr  没有进程(只有错误)到stderr

    执行:

    userdeMBP:~ user$ svnserve -d -r /Users/user/mySVN/myCode  //没有反应则成功
    userdeMBP:~ user$ 

    然后可以到活动监视器中查看它,如下图

    4)关闭svn服务器——直接在活动监视器上关闭它

    到这里svn服务端的使用就讲完了,下面要讲的是其客户端的使用

  • 相关阅读:
    沉淀再出发:在python3中导入自定义的包
    沉淀再出发:java中的equals()辨析
    沉淀再出发:web服务器和应用服务器之间的区别和联系
    沉淀再出发:jetty的架构和本质
    沉淀再出发:dubbo的基本原理和应用实例
    沉淀再出发:OpenStack初探
    沉淀再出发:Spring的架构理解
    沉淀再出发:关于IntelliJ IDEA使用的一些总结
    沉淀再出发:spring boot的理解
    沉淀再出发:Bean,JavaBean,POJO,VO,PO,EJB等名词的异同
  • 原文地址:https://www.cnblogs.com/wanghui-garcia/p/10220363.html
Copyright © 2011-2022 走看看