Subversion+Apache HTTP server安装配置

1.安装subversion1.6

   参考http://www.subversion.org.cn/?action-viewnews-itemid-1

 

   p.s.本来想安装最新的subversion1.7的 但下载的都是.zip包,实在看不懂安装说明,只有打消念头了。

         如果有会得,欢迎指导!

 

2.安装Apache HTTP server

  使用的安装文件是apache_2.0.48-win32-x86-no_ssl.msi

  具体参考http://heavyz.sourceforge.net/homepage/homepage_zh/comp/notes/apache-2.0.html

 

3.配置

 (参考自http://www.ibm.com/developerworks/cn/java/j-lo-apache-subversion/

   (1)连接subversion和apache

   为了使 Subversion 与 dav 模块通信,需要安装 mod_dav_svn 插件,可以在 Subversion 的安装目录(ect\Subversion\bin)中找到。将其拷贝   到 Apache 安装目录的 modules 文件夹下。

接下来就是配置 Apache 的 httpd.conf文件(ect\Apache2.2\conf下) ,让 Apache 在启动的时候加载上述模块。

我的svn库地址是F:/svn/repository/test

在httpd.conf中添加的内容如下:

LoadModule dav_module modules/mod_dav.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /test>
  DAV svn
  SVNPath F:/svn/repository/test
</Location>

    保存后重启Apache,在浏览器中输入  http://服务器ip/test/  ,则显示出版本库中相应信息

     主要就是版本库中目录结构

    (不会导入图片= =)

    注意:<location>标签 为版本库名;输入的URL, 是直接到版本库位置test。

 

 

如果想要指定多个版本库,可以用多个 Location 标签,也可以使用 SVNParentPath 代替 SVNPath,例如在 F:/svn/repository 下有多个版本库 repos1,repos2 等等,用如下方式指定:

<Location /repository>
  DAV svn
  SVNParentPath F:/svn/repository
</Location>

 

  注意:标签<location> 要修改到版本库上级目录repository。

其中,"SVNParentPath F:/svn/repository " 表示 F:/svn/repository 下的每个子目录都是一个版本库。可以通过 http://服务器IP/repository/repos1http://服务器IP/repository/repos2 来访问。

 (2)授权控制

      在location标签中增加语句:

AuthType Basic
AuthName "svn repos"
AuthUserFile F:/svn/user.auth
Require valid-user

     显然需要创建相关的文件user.auth。这个我们可以利用Apache2.2中提供的htpass工具完成。

     打开DOS命令行,进去Apache2.2\bin下:

     D:\Program Files\Apache \Apache2.2\bin>htpasswd -cb F:\svn\user.auth user1 1234

      Adding password for user user1

    D:\Program Files\Apache \Apache2.2\bin>htpasswd -b F:\svn\user.auth user2 1234

      Adding password for user user2

    语句1的意思是在F:\svn下创建文件user.auth,并添加用户user1,其密码为1234.

    语句2的意思是在F:\svn下文件user.auth中,添加用户user2,其密码为1234.

    查看user.auth文件,我们可以看到密码已经加密。

   注意:如果不指定创建位置,user.auth在bin目录下;httpd.conf中AuthUserFile的位置要随之变化。

 

   相关htpasswd用法:

 

   htpasswd [-cmdpsD] passwordfile username

        htpasswd -b[cmdpsD] passwordfile username password


        htpasswd -n[mdps] username

        htpasswd -nb[mdps] username password

  -c  Create a new file.

  -n  Don't update file; display results on stdout.

  -m  Force MD5 encryption of the password (default).

  -d  Force CRYPT encryption of the password.

  -p  Do not encrypt the password (plaintext).

  -s  Force SHA encryption of the password.

  -b  Use the password from the command line rather than prompting for it.

  -D  Delete the specified user.

 

 

   为增加读写权限控制,还可以在标签location中增加语句

AuthzSVNAccessFile F:/svn/access.auth

 

   在指定位置新建文件access.auth:内容如下:

 

 

[test:/]

user1 = rw

user2 = rw

 

   详情可参考版本库的配置文件authz(我的位置是F:\svn\repository\test\conf\authz)。

  注意:文件中一定是[版本库名:/]。我之前配置的是SVNParentPath,打算允许访问repository下所有版本库而使用

          [repository:/],运行时出现403报错

 

 

 

 

      

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值