zoukankan      html  css  js  c++  java
  • 浏览器访问svn

    文章转自https://www.cnblogs.com/ayanmw/archive/2011/12/19/2294054.html

    你看到的这个文章来自于http://www.cnblogs.com/ayanmw

    基本的安装包有: subversion /httpd/ svn的httpd的mod_dav_svn mod_authz_svn 两个模块.(yum install mod_dav_svn subversion httpd )

    svn的服务形式应该是有两种: 1 通过svnserve建立的 通过svn://ip:port 端口默认是3690,这种形式; 2 通过apache httpd或者其他的web服务器的扩展模块,进行svn管理

    对于svnserve,通过svnserve -d -r /var/www/svn 这种形式建立 daemon的后台进程,但是结束要 kill `pgrep svnserve` 这种形式 来kill掉,不知道有没有直接的比如 stop的方式.

    通过http服务器来管理svn也很不错,可以很方便的浏览.其配置过程如下(首先几个软件都安装,这就不用说了.):

    1.在 /etc/httpd/module下面 有两个 mod 关于 svn的.

    2.在/etc/httpd/config.d/下有一个subversion.conf(没有就建立一个),其内容是:

    复制代码
    LoadModule dav_module         modules/mod_dav.so
    LoadModule dav_svn_module modules/mod_dav_svn.so
    <Location /svn>
    DAV svn
    SVNPath /var/www/svn/
    AuthType Basic
    AuthName "Subversion repos"
    AuthUserFile /var/www/svn/repos1/conf/passwd
    Require valid-user
    </Location>

    # To create a new repository "http://localhost/repos/stuff" using
    # this configuration, run as root:
    #
    # # cd /var/www/svn
    # # svnadmin create stuff
    # # chown -R apache.apache stuff
    # # chcon -R -t httpd_sys_content_t stuff

    #<Location /repos>
    # DAV svn
    # SVNParentPath /var/www/svn
    #
    # # Limit write permission to list of valid users.
    # <LimitExcept GET PROPFIND OPTIONS REPORT>
    # # Require SSL connection for password protection.
    # # SSLRequireSSL
    #
    # AuthType Basic
    # AuthName "Authorization Realm"
    # AuthUserFile /path/to/passwdfile
    # Require valid-user
    # </LimitExcept>
    #</Location>

    复制代码

    其中/var/www/svn是准备放仓库的目录,这个目录可以放置多个代码仓库,AuthUserFile就是用户和密码的文件,也可以移动到其他地方单独管理.

    /var/www/svn 下面可以通过 svnadmin createa /var/www/svn/repos1 来建立一个空的仓库.还可以建立多个仓库;这个目录貌似最好 给apche用户所有权限:chown -R apache.apache /var/www/svn ;在repos1/conf目录下可以进行一些账号密码 配置,就不多说了.建立的其他仓库 可以拷贝这些conf文件

    其中AuthUserFile 是如何制作的呢?

    复制代码
    创建“ AuthUserFile ”设置所需的用户密码以及存储的文件
    
    使用 apache bin/htpasswd 命令来创建。命令的格式为
    
    htpasswd [-cmdpsD] passwordfile username
    
    
    若第一次创建用户,我们必须使用参数“-c”来同时创建用户密码文件
    
    htpasswd -c passwd robert
    
    上述命令创建的一个文件“ passwd”,同时在文件里添加了一个 user named “robert”,执行该命令时会要求输入密码。
    
    
    注意:创建第二或之后的用户时,一定不能用参数“ c ”,否则之前的用户就会被删除。
    
    
    如果想要删除某个用户,我们可以使用下列命令:
    
        htpasswd -D passwd robert
    
    这样, robert就被从 passwd中删除了。
    复制代码

    下面就是一个示例,创建两个用户 a b,密码 aaa,bbb,再删除。查看密码文件内容:

    复制代码
    [root@src-server websvn]# htpasswd accesspwd a
    htpasswd: cannot modify file accesspwd; use '-c' to create it
    [root@src-server websvn]# htpasswd -c accesspwd a
    New password:
    Re-type new password:
    Adding password for user a
    [root@src-server websvn]# ll accesspwd
    -rw-r--r-- 1 root root 16 Jun 23 02:03 accesspwd
    [root@src-server websvn]# htpasswd accesspwd b
    New password:
    Re-type new password:
    Adding password for user b
    [root@src-server websvn]# cat accesspwd
    a:wpEqdKjINQsvM
    b:JEpHUbhZZP3fc
    [root@src-server websvn]# htpasswd -D accesspwd b
    Deleting password for user b
    [root@src-server websvn]# cat accesspwd
    a:wpEqdKjINQsvM
    [root@src-server websvn]#
    复制代码

    3. sudo service httpd restart 重启httpd apache 服务. 貌似很简单呢..回来再整理下svn的命令 补充.

    然后通过 http://IP/svn/repos1可以访问这个仓库,可以建立多个仓库同时访问.不过直接访问 IP/svn 无法列出仓库的列表,apache显示 "forbidden You don't have permission to access /svn on this server"

    对于一些svn的web管理程序也有,比如ViewVC 还有一些其他的管理svn的web程序,最好可以在web端创建仓库、权限管理就好了。目前寻找这样的svn web管理程序中。

    CentOS 安装websvn直接yum即可,不需要配置mysql,只需要php的支持即可。

    查看websvn的包文件

    复制代码
    [root@src-server ~]# yum install websvn
    Loaded plugins: fastestmirror, presto, refresh-packagekit
    Loading mirror speeds from cached hostfile
     * base: mirrors.btte.net
     * epel: ftp.kddilabs.jp
     * extras: ftp.stu.edu.tw
     * kernel-xen: us1.mirror.crc.id.au
     * updates: mirrors.tuna.tsinghua.edu.cn
    Setting up Install Process
    Package websvn-2.3.3-2.el6.noarch already installed and latest version
    Nothing to do
    [root@src-server ~]#rpm -ql websvn
    /etc/httpd/conf.d/websvn.conf
    /etc/websvn/config.php
    /usr/share/doc/websvn-2.3.3
    /usr/share/doc/websvn-2.3.3/changes.txt
    /usr/share/doc/websvn-2.3.3/doc
    /usr/share/doc/websvn-2.3.3/doc/install.html
    /usr/share/doc/websvn-2.3.3/doc/style.css
    /usr/share/doc/websvn-2.3.3/doc/templates.html
    /usr/share/doc/websvn-2.3.3/license.txt
    /usr/share/websvn
    /usr/share/websvn/blame.php
    /usr/share/websvn/cache
    /usr/share/websvn/comp.php
    /usr/share/websvn/diff.php
    /usr/share/websvn/dl.php
    /usr/share/websvn/filedetails.php
    /usr/share/websvn/include
    /usr/share/websvn/include/accessfile.php
    /usr/share/websvn/include/auth.php
    /usr/share/websvn/include/bugtraq.php
    /usr/share/websvn/include/command.php
    /usr/share/websvn/include/config.php
    /usr/share/websvn/include/configclass.php
    /usr/share/websvn/include/diff_inc.php
    /usr/share/websvn/include/diff_util.php
    /usr/share/websvn/include/header
    /usr/share/websvn/include/setup.php
    /usr/share/websvn/include/svnlook.php
    /usr/share/websvn/include/template.php
    /usr/share/websvn/include/utils.php
    /usr/share/websvn/include/version.php
    /usr/share/websvn/index.php
    /usr/share/websvn/languages
    /usr/share/websvn/languages/chinese-simplified.php
    /usr/share/websvn/languages/languages.php
    /usr/share/websvn/languages/省略省略省略
    /usr/share/websvn/listing.php
    /usr/share/websvn/log.php
    /usr/share/websvn/revision.php
    /usr/share/websvn/rss.php
    /usr/share/websvn/temp
    /usr/share/websvn/templates
    /usr/share/websvn/templates/BlueGrey
    /usr/share/websvn/templates/BlueGrey/省略省略省略
    /usr/share/websvn/templates/Elegant
    /usr/share/websvn/templates/Elegant/省略省略省略
    /usr/share/websvn/templates/calm
    /usr/share/websvn/templates/calm/省略省略省略
    /usr/share/websvn/wsvn.php
    /var/cache/websvn
    复制代码

    下面就是vim /etc/websvn/config.php,其实这个文件就是/usr/share/websvn/include/config.php,只是做了一个链接到etc目录,这种方法对于这种需要配置的web程序来说,还真是方便。

    复制代码
    [root@src-server ~]# ll /etc/websvn/config.php
    -rw-r--r-- 1 root root 21210 Jun 24 18:48 /etc/websvn/config.php
    [root@src-server ~]# ll /usr/share/websvn/include/config.php
    lrwxrwxrwx 1 root root 33 Jun 23 01:01 /usr/share/websvn/include/config.php -> ../../../../etc/websvn/config.php
    [root@src-server ~]#
    复制代码

    这里需要修改的配置选项有:

    $config->parentPath('/srv/svn/');

    $config->useMultiViews();

    ############ $config->useAuthenticationFile('/srv/svn/passwd');#这里是因为我 不知道如何在websvn上登录我的账号

     $config->setBlockRobots();#防止搜索程序收录

    $config->expandTabsBy(4);#默认的8 似乎并不适合我的习惯

    $config->useEnscript();##语法高亮 建议安装GNU Enscript高亮显示程序包,官方下载:http://www.iki.fi/~mtr/genscript/

    #  关于编码 我不知道如何设置,SetInputEncoding 对于我的websvn-2.3.3不起作用,反而websvn出现500错误。

    修改/etc/httpd/conf.d/websvn.conf 添加基本权限认证

    复制代码
    Alias /websvn /usr/share/websvn/
    
    <Directory /usr/share/websvn/>
       Options MultiViews Indexes
       DirectoryIndex wsvn.php
       order allow,deny
       allow from all
            AuthType Basic
            AuthName "Authorization Realm"
            AuthUserFile /srv/svn/passwd
            Require valid-user
    
    </Directory>
    复制代码

    websvn就可以在线浏览了。

     第三节:在线修改htpasswd密码

    前面是由apache的htpasswd来通过 base 认证来进行账号管理的。通过这个小程序可以在线添加删除 校验账号密码。还有点小遗憾是 没有对 添加 删除 进行权限管理。校验后 才可以进行这个选项。

    http://www.cnblogs.com/mutuan/archive/2012/07/27/2611537.html

    参考:http://www.scmbbs.com/cn/svntp/2007/11/svntp1.php

    转载请注明出处:http://www.cnblogs.com/ayanmw 我会很高兴的!

    ------------------------------------------------------------------------------------------------

    一定要专业!本博客定位于 ,C语言,C++语言,Java语言,Android开发和少量的Web开发,之前是做Web开发的,其实就是ASP维护,发现EasyASP这个好框架,对前端后端数据库 都很感觉亲切啊。. linux,总之后台开发多一点。以后也愿意学习 cocos2d-x 游戏客户端的开发。

  • 相关阅读:
    leecode4:寻找两个正序数组的中位数
    leecode3:无重复字符的最长子串
    leecode2:两数相加
    KMP字符串模式匹配
    01迷宫问题
    汉诺塔问题
    微服务-基于Grpc的进程通信-Grpc异常捕获RpcException(4-4)
    React-Antd Pro增删改查
    HTTP 请求
    创业路上-1
  • 原文地址:https://www.cnblogs.com/shuaiandjun/p/9624665.html
Copyright © 2011-2022 走看看