Fedora 11 上安装subversion 和apache服务器
轉(zhuǎn)載請注明出處 http://blog.csdn.net/sunxinrui1983/archive/2009/09/15/4554694.aspx
一、需要安裝數(shù)據(jù)包
?
?? #yum install apr
?? #yum install mod_dav_svn
?
二、配置apache服務(wù)器
? 配置apache服務(wù)器,使其加載subversion模塊。
在/etc/httpd/conf.d/下看看能否找到subversion.conf,如果沒有,按照下面內(nèi)容建立該文件
?
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數(shù)據(jù)庫的路徑,如果有多個項目,則指向多個項目的父目錄,用戶可以通過http://ip_addr/repos/project_1來訪問。
AuthUserFile指明http訪問用戶名,密碼驗證文件路徑,如果不設(shè)置用戶名,密碼則該部分可以注釋掉。添加用戶用如下命令:
htpasswd -c /etc/httpd/conf.d/authfile sxr
-c表示創(chuàng)建,以后添加則不需此參數(shù)。
AuthzSVNAccessFile 指明詳細(xì)權(quán)限設(shè)置文件路徑,該文件可以進(jìn)一步指明不同項目的訪問權(quán)限,該文件的格式如下(需要注意每行前面不能有空格 ):
[groups]
sxr = sxr
stb_sxr = stb_sxr
[AR6k:/]
sxr = rw
[linux-2.6.30:/]
stb_sxr = rw
三、重新啟動apache服務(wù)
#apachectl restart
?
附錄:設(shè)置subversion庫
用如下命令創(chuàng)建subversion管理庫
#mkdir /public/svn/AR6k
#svnadmin create /public/svn/AR6k
參考如下內(nèi)容編輯配置文件
#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
?
?
導(dǎo)入工程文件
#svn import AR6k files:///public/svn/AR6k -m "original"
?
如果想直接使用subversion提供的簡單服務(wù)器,可以參考示例配置以下兩個文件
????? #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服務(wù)器
#svnserve -d -r /public/svn/
?
然后就可以通過svn://ip_addr/AR6k 來訪問代碼庫。
?
?
?
?
總結(jié)
以上是生活随笔為你收集整理的Fedora 11 上安装subversion 和apache服务器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第一个blog
- 下一篇: 在麻省理工读计算机专业,看美国的计算机教