CentOS   发布时间:2022-04-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了CentOS Linux下配置svn HTTP server大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

原文链接:http://www.cnblogs.com/ayanmw/archive/2011/12/19/2294054.html 基本的安装包有: subversion /httpd/ svn的httpd的mod_dav_svn mod_authz_svn 两个模块.(yum install mod_dav_svn subversion httpd ) svn的服务形式应该是有两种: 1 通过

原文链接:http://www.cnblogs.com/ayanmw/archive/2011/12/19/2294054.html


基本的安装包有: 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 \n 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 游戏客户端的开发。

大佬总结

以上是大佬教程为你收集整理的CentOS Linux下配置svn HTTP server全部内容,希望文章能够帮你解决CentOS Linux下配置svn HTTP server所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:http