• apache搭建svn服务器


    2010年项目开发过程中 试用了svn作为版本控制,使用TortoiseSVN客户端,同时用apache配置成浏览器访问,更加方便,此文就是记录配置过程,记录解决问题过程的。

    安装

    apt-get install subversion subversion-tools apache2 libapache2-svn


    创建储存库

    svnadmin create /home/machine/svn/aviation

    创建一个新的空储存库,数据储存方式默认采用Berkeley DB。


    导入源码


    svn import /home/machine/jdeproject/aviation file:////home/machine/svn/aviation

    配置

    配置文件位于/etc/apache2/mods-enabled/目录下,配置文件共有两个,分别是dav_svn.conf和dav_svn.load,dav_svn.load文件负责装载必要的模块,dav_svn.conf是mod_dav_svn.so模块的配置文件,修改:

     1 # dav_svn.conf - Example Subversion/Apache configuration
     2 #
     3 # For details and further options see the Apache user manual and
     4 # the Subversion book.
     5 #
     6 # NOTE: for a setup with multiple vhosts, you will want to do this
     7 # configuration in /etc/apache2/sites-available/*, not here.
     8 
     9 # <Location URL> ... </Location>
    10 # URL controls how the repository appears to the outside world.
    11 # In this example clients access the repository as http://hostname/svn/
    12 # Note, a literal /svn should NOT exist in your document root.
    13 
    14   #设置访问路径
    15   <Location /aviation>
    16 
    17   # Uncomment this to enable the repository
    18   #启用
    19   DAV svn
    20 
    21   # Set this to the path to your repository
    22   #设置储存库路径,仅支持单个储存库,该路径要可被Apache进程访问。
    23   SVNPath /home/machine/svn/aviation
    24   # Alternatively, use SVNParentPath if you have multiple repositories under
    25   # under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
    26   # You need either SVNPath and SVNParentPath, but not both.
    27   #SVNParentPath /var/lib/svn
    28 
    29   # Access control is done at 3 levels: (1) Apache authentication, via
    30   # any of several methods.  A "Basic Auth" section is commented out
    31   # below.  (2) Apache <Limit> and <LimitExcept>, also commented out
    32   # below.  (3) mod_authz_svn is a svn-specific authorization module
    33   # which offers fine-grained read/write access control for paths
    34   # within a repository.  (The first two layers are coarse-grained; you
    35   # can only enable/disable access to an entire repository.)  Note that
    36   # mod_authz_svn is noticeably slower than the other two layers, so if
    37   # you don't need the fine-grained control, don't configure it.
    38 
    39   # Basic Authentication is repository-wide.  It is not secure unless
    40   # you are using https.  See the 'htpasswd' command to create and
    41   # manage the password file - and the documentation for the
    42   # 'auth_basic' and 'authn_file' modules, which you will need for this
    43   # (enable them with 'a2enmod').
    44   #启用Apache基础验证
    45   AuthType Basic
    46   #设置验证框标题
    47   AuthName "Subversion Repository"
    48   #指定验证用户文件名
    49   AuthUserFile /etc/apache2/dav_svn.passwd
    50 
    51   # To enable authorization via mod_authz_svn
    52   #启用目录级别授权,dav_svn.authz是授权配置文档
    53   #AuthzSVNAccessFile /etc/apache2/dav_svn.authz
    54 
    55   # The following three lines allow anonymous read, but make
    56   # committers authenticate themselves.  It requires the 'authz_user'
    57   # module (enable it with 'a2enmod').
    58   #<LimitExcept GET PROPFIND OPTIONS REPORT>
    59   #允许匿名访问,不允许Commit,不能与AuthzSVNAccessFile同时使用
    60   Require valid-user
    61   #</LimitExcept>
    62 
    63 </Location>

    权限修改

    修改/home/machine/jdeproject/aviation/目录访问权限使它可被Apache进程访问,也就是其他用户可访问.

    drwxr-xr-6 machine machine 4096 10-27 19:25 aviation

    添加授权

    通过Apache的用户验证功能可以区别匿名用户和验证用户,从而赋予匿名用户读权限和验证用户读/写的权限。授权文档dav_svn.conf定义:etc/apache2/dav_svn.authz,它的内容如下:

    # 定义组
    [groups]             
    # 定义admin组及组内的用户
    admin = machine
    # 定义user组及组内的用户
    users = zhao,song

    # 定义根的权限
    [/]        
    # 全部用户不具备任何权限
    *=              
    # admin组具备读写权限       
    @admin = rw     
    # user具备只读权限
    @user = r        

     添加用户

    htpasswd -/etc/apache2/dev_svn.passwd machine
    New password:
    Re
    -type new password:
    #省略添加其他用户的过程,注意参数,首次创建需要-c,增加的时候只要-d
    htpasswd -/etc/apache2/dev_svn.passwd song
    New password:
    Re
    -type new password:

    使用

    现在可以在浏览器中输入http://127.0.0.1/aviation访问源代码,可以使用svn客户端管理源代码了。:)
  • 相关阅读:
    Java中printf
    error C3688: invalid literal suffix '__FSTREXP'; literal operator or literal operator template 'operator ""__FSTREXP' not found
    C# IIS 访问网络映射磁盘 读取文件列表
    datatables 参数详解
    Telnet协议详解
    WCF中的ServiceHost初始化两种方式
    C# FTP 上传、下载、获取文件列表
    Oracle存储过程编译卡死的解决方法
    oracle 查询表结构
    Oracle大数据常见优化查询
  • 原文地址:https://www.cnblogs.com/machine/p/linux_svn1.html
Copyright © 2020-2023  润新知