工作中~
分类: LINUX
2008-08-27 11:39:00
# Depends: dav
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so
LoadModule authz_svn_module /usr/lib/apache2/modules/mod_authz_svn.so
LoadModule dav_module /usr/lib/apache2/modules/mod_dav.sodav_svn.conf是mod_dav_svn.so模块的配置文件,内容如下:
# dav_svn.conf - Example Subversion/Apache configuration4.更改该目录的拥有者为网页读取
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.
#...
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as
# Note, a literal /svn should NOT exist in your document root.#设置访问路径
# Uncomment this to enable the repository,
DAV svn #启用
# Set this to the path to your repository
SVNPath /home/svn #设置版本存储库路径,仅支持单个储存库,该路径要可被Apache进程访问。
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, ...).
# You need either SVNPath and SVNParentPath, but not both.
#SVNParentPath /data/subversion #如果subversion下有多个储存库,则用SVNParentPath
# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A "Basic Auth" section is commented out
# below. (2) Apacheand , also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don't need the fine-grained control, don't configure it.
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the 'htpasswd' command to create and
# manage the password file - and the documentation for the
# 'auth_basic' and 'authn_file' modules, which you will need for this
# (enable them with 'a2enmod').
AuthType Basic #启用Apache基础验证
AuthName "Subversion Repository" #设置验证框标题
AuthUserFile /etc/apache2/dav_svn.passwd #指定验证用户文件名
# To enable authorization via mod_authz_svn
# AuthzSVNAccessFile /etc/apache2/dav_svn.authz #启用目录级别授权,dav_svn.authz是
授权配置文档
# The following three lines allow anonymous read, but make
# committers authenticate themselves. It requires the 'authz_user'
# module (enable it with 'a2enmod').
#允许匿名访问,不允许Commit,不能
与AuthzSVNAccessFile同时使用
Require valid-user
[groups] #定义组
admin=lxq001,lxq007
tests=test1,test2
[lxq:/] #定义lxq版本库根目录的访问权限
@admin=rw #admin组有读写权限
tests=r #test用户只有读权限
[lxq:/test] #定义oa版本库下test目录的访问权限
*= #禁止所有用户访问,星号代表所有用户,权限为空代表没有任何权限
lxq=rw #打开lxq001用户的读写权限
6.增加apache连接进来的使用者帐号 /etc/apache2/dev_svn.passwd
debian:/# htpasswd -c /etc/apache2/dav_svn.passwd lixueq
New password:
Re-type new password:
Adding password for user lixueq
debian:/# htpasswd -c /etc/apache2/dev_svn.passwd test1
7.重启apache2
在/etc/apache2/sites-available/default中添加:
DAV svn
SVNListParentPath on
SVNParentPath /home/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
然后重启apache2
debian:/# nano /etc/init.d/apache2 restart
8.导入你的源码:
debian:/# svn import /var/www/web1 file:///home/svn/lxq
9.显示储存库内容:
debian:/# svn list file:///home/svn/lxq
index.php
a.php
显示web1目录内容,成功导入。
使用svn://访问,需开启此服务:
debian:/# svnserve -d -r /home/svn/lxq/
上面我使用了file:///形式的URL来访问Subversion库,这表示在本地通过文件系统访问。但我们的Subversion库可能需要通过网络被其它用户访问,这就需要用到其它的协议,下表是Subversion支持的各种访问协议:
Table 访问协议
协议 | 访问方法 |
---|---|
file:/// | 通过本地磁盘访问。 |
http:// | 与Apache组合,通过WebDAV协议访问。 |
https:// | 同上,但支持SSL协议加密连接。 |
svn:// | 通过svnserve服务自定义的协议访问。 |
svn+ssh:// | 同上,但通过SSH协议加密连接。 |