Fedora 11 上安装subversion 和apache服务器

转载请注明出处 http://blog.csdn.net/sunxinrui1983/archive/2009/09/15/4554694.aspx

一、需要安装数据包

 

   #yum install apr

   #yum install mod_dav_svn

 

二、配置apache服务器

  配置apache服务器,使其加载subversion模块。

在/etc/httpd/conf.d/下看看能否找到subversion.conf,如果没有,按照下面内容建立该文件

 

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
#LoadModule dav_module modules/mod_dav.so

#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn".  Each repository
# must be both:
#
#   a) readable and writable by the 'apache' user, and
#
#   b) labelled with the 'http_sys_content_rw_t' context if using
#   SELinux
#

#
# 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 -t http_sys_content_rw_t stuff
#

<Location /repos>
     DAV svn
     SVNParentPath /public/svn/
#
#   # Limit write permission to list of valid users.
#   <LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
      AuthzSVNAccessFile /etc/httpd/authz.conf
      AuthType Basic
      AuthName "Please enter your name and password"
      AuthUserFile /etc/httpd/conf.d/authfile
      Require valid-user
#   </LimitExcept>
</Location>

 

其中:

SVNParentPath指明svn数据库的路径,如果有多个项目,则指向多个项目的父目录,用户可以通过http://ip_addr/repos/project_1来访问。

AuthUserFile指明http访问用户名,密码验证文件路径,如果不设置用户名,密码则该部分可以注释掉。添加用户用如下命令:

htpasswd -c /etc/httpd/conf.d/authfile sxr

-c表示创建,以后添加则不需此参数。

AuthzSVNAccessFile 指明详细权限设置文件路径,该文件可以进一步指明不同项目的访问权限,该文件的格式如下(需要注意每行前面不能有空格 ):

[groups]
sxr = sxr
stb_sxr = stb_sxr

[AR6k:/]
sxr = rw

[linux-2.6.30:/]
stb_sxr = rw

三、重新启动apache服务

#apachectl restart

 

附录:设置subversion库

用如下命令创建subversion管理库

#mkdir /public/svn/AR6k

#svnadmin create /public/svn/AR6k

参考如下内容编辑配置文件

#cat /public/svn/AR6k/conf/svnserve.conf

 

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
# realm = My First Repository

 

 

导入工程文件

#svn import AR6k files:///public/svn/AR6k -m "original"

 

如果想直接使用subversion提供的简单服务器,可以参考示例配置以下两个文件

      #vi /public/svn/AR6k/conf/authz

### This file is an example authorization file for svnserve.


[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
sxr = sxr
cvs = cvsroot

[repository:/public/svn/AR6k]
 @sxr = rw
# @harry_and_sally = rw
# * = r
[AR6k:/]
@sxr = rw
@cvs = rw

其中@sxr表示sxr组

 

#vi /public/svn/AR6k/conf/passwd

 

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
sxr = sxr
cvsroot = cvsroot

 

启动subversion服务器

#svnserve -d -r /public/svn/

 

然后就可以通过svn://ip_addr/AR6k 来访问代码库。

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值