zoukankan      html  css  js  c++  java
  • linux centos 下面httpd支持的svn 服务器端安装

    http://blog.51yip.com/server/291.html

    一,Subversion有两种运行方式

    一种是基于Apache Http Server另外一种是Subversion Standalone Server

    以下是基于httpd的svn的安装

    二,安装svn

    yum install httpd httpd-devel subversion mod_dav_svn

    如果你已经装了apache了,不想装二个apache的话。你可以单独下个subversion来装一下就行了。

    注意一点的是,路径要正确:

    #./configure --with-apxs=/apache路径/bin/apxs --prefix=/usr/local/subversion
    --with-apr=/usr/local/apache2 --with-apr-util=/apache路径 --with-ssl --with-zlib
    --enable-maintainer-mode

    1),确定已经安装了svn模块:mod_dav_svn

    [root@svn zhangying]# cd /etc/httpd/modules/
    [root@svn modules]# ls |grep svn
    mod_authz_svn.so
    mod_dav_svn.so
    [root@svn modules]#

    2),看一下svn是否已安装成功

    [root@svn modules]# svn --version
    svn, version 1.4.2 (r22196)
    compiled Aug 10 2009, 18:00:04

    Copyright (C) 2000-2006 CollabNet.
    Subversion is open source software, see http://subversion.tigris.org/
    This product includes software developed by CollabNet (http://www.Collab.Net/).

    The following repository access (RA) modules are available:

    * ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
    - handles 'http' scheme
    - handles 'https' scheme
    * ra_svn : Module for accessing a repository using the svn network protocol.
    - handles 'svn' scheme
    * ra_local : Module for accessing a repository on local disk.
    - handles 'file' scheme

    三,创建仓库,修改svn配置文件

    1),加载模块

    [root@svn conf.d]#cd /etc/httpd/conf.d

    [root@svn conf.d]# nano subversion.conf

    添加以下二行

    LoadModule dav_svn_module     modules/mod_dav_svn.so
    LoadModule authz_svn_module   modules/mod_authz_svn.so

    2),创建仓库,以及仓库目录的设置

    # mkdir -p /var/www/svn

    # cd /var/www/svn

    # svnadmin create test

    # chown -R apache.apache test

    # vi /etc/httpd/conf.d/subversion.conf

    <Location /svn>
    DAV svn
    #注意,下面的路径,子文件夹名不能和父文件名重复,不然就会出问题

    SVNParentPath /var/www/svn/repository
    #
    #   # Limit write permission to list of valid users.
    #   <LimitExcept GET PROPFIND OPTIONS REPORT>
    #      # Require SSL connection for password protection.
    #      # SSLRequireSSL
    #
    AuthType Basic
    AuthName "Subversion repository"
    AuthzSVNAccessFile /var/www/svn/repository/authz.conf
    AuthUserFile /var/www/svn/repository/authfile
    Require valid-user
    #   </LimitExcept>
    </Location>

    3),添加用户

    下面建立可访问用户文件

    # htpasswd -c /var/www/svn/repository/authfile 用户名

    要增加用户,则使用下面命令

    # htpasswd /var/www/svn/repository/authfile 用户名
    
    //第一次设置用户时使用-c表示新建一个用户文件。回车后输入用户密码,完成对用户的增加
    当你用页面访问svn时,apache要进行的密码确认
    
    
    
    4),权限分限
    # nano /var/www/svn/repository/authz.conf
     [test:/] //这表示,仓库test的根目录下的访问权限 
     zhangy = rw //test仓库zhangy用户具有读和写权限 
     hunk = r //test仓库hunk用户具有读权限 
     [/] //这个表示在所有仓库的根目录下 
     * = r //这个表示对所有的用户都具有读权限 
     #[groups] //这个表示群组设置 
     #svn1-developers = zhangy, hunk //这个表示某群组里的成员 
     #svn2-developers = zhangy
     #[svn1:/]
     #@svn1-developers = rw //如果在前面加上@符号,则表示这是个群组权限设置

    搞好之后重起apache

    # service httpd restart
    
    5),svn的一些操作
    a.import操作
    [root@svn www] svn import /var/www/zhangy/test/ file:///var/www/svn/repository/test -m "Initial repository test"
    Adding         /var/www/zhangy/test.txt
     Adding         /var/www/zhangy/test1.txt
    
    注意:
    1,file:///在这里是3个/,我开始导入时写成了二个,老是报错,我就很晕。
    2,在导入时,如果存在中文字符的文件名导入会停止报错
    
    b.check out操作
    [root@svn www] cd /var/www
    [root@svn www] svn co http://yoursvnserver/svn/test
    Authentication realm: &lt;http://yoursvnserver:80&gt; Subversion repositoryPassword for 'youruser':
    A    test/test.txt
    A    test/test1.txt
    Checked out revision 1.
    
    c.edit和commit操作
    [root@svn www] cd /var/www
    [root@svn www] nano test.txt -- 修改一些东西后.
    [root@svn www] svn commit -m "Added a line to test.txt."
    Sending        test/test.txt
    Transmitting file data .
    Committed revision 2.
    
    d.add和delete操作
    [root@svn www] svn co http://yoursvnserver/svn/test
    [root@svn www] cd /var/www
    [root@svn www] nano test2.txt -- 添加一个新文件.
    [me@mylappy ~] svn add test2.txt
    A         test2.txt
    
    [me@mylappy ~] svn commit -m "new one"
    Adding         test2.txt
    Transmitting file data .
    Committed revision 3.
    
    删除操作把add换成delete就可以了
    TortoiseSVN客户端,网上搜一下,到处都是,在这儿就不罗嗦

    参考文档
    http://wiki.centos.org/HowTos/Subversion?highlight=%28subversion%29

  • 相关阅读:
    SQL后台分页三种方案和分析
    SQL分页查询语句
    SQL利用临时表实现动态列、动态添加列
    查询sybase DB中占用空间最多的前20张表
    敏捷软件开发之TDD(一)
    敏捷软件开发之开篇
    Sql Server 2012启动存储过程
    改变VS2013的菜单栏字母为小写
    Sql Server获得每个表的行数
    Sql Server trace flags
  • 原文地址:https://www.cnblogs.com/abcbuzhiming/p/2921304.html
Copyright © 2011-2022 走看看