环境
Windows 2003
Setup-Subversion-1.6.17.msi SVN服务器端
httpd-2.2.19-win32-x86-no_ssl.msi Apache
TortoiseSVN-1.6.7.18415-win32-svn-1.6.9.msi SVN客户端
安装步骤
一 安装程序下载
Apache Web服务器 :http://httpd.apache.org/download.cgi (我下载的是httpd-2.2.19-win32-x86-no_ssl.msi )
Subversion :(http://subversion.tigris.org/,去这里找吧)
TortoiseSVN 客户端工具 (TortoiseSVN-1.6.7.18415-win32-svn-1.6.9.ms)
二 程序安装
1. apache安装:安装步骤就不说了,简单。需要注意的一点就是检查本机的iis端口号不要和apache冲突,此apache包的默认端口是80。安装前先停止iis服务。安装完成后,修改监听端口。打开文件C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.
conf,将listen 80 改为 listen 88。然后打开 http://loccalhost:88,如果能出现内容,那你的Apache就安装成功了。
2.运行Subversion安装程序,安装完成后做以下手工配置:
(1)如果你先安装Apache,再安装Subversion,进入Subversion的安装目录(默认为c:\program files\Subversion),找到文件httpd/mod_dav_svn.so、mod_authz_svn.so、libdb44.dll,将它们拷贝到Apache的modules目录(我的为C:\Program Files\Apache Software Foundation\Apache2.2\modules)。
(2)编辑Apache的配置文件(我的为C:\Program Files\Apache Software Foundation\Apache2.2conf\httd.conf),修改以下内容:
去掉以下行的注释(将开头的#删除):
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_module modules/mod_dav.so
在LoadModule节的最后添加以下两行:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
在配置文件的最后添加下面这些行:
<Location /svn>
DAV svn
SVNParentPath C:\svn
AuthType Basic
AuthName "test"
AuthzSVNAccessFile C:\SVN\test\conf\authz
AuthUserFile "C:\Program Files\Apache Software Foundation\Apache2.2\bin\passwd"
Require valid-user
</Location>
配置表示:你所有的版本库将位于C:\SVN目录下,要访问你的版本库可以使用这样的URL:http://localhost/svn/,访问权限将由passwd文件中的用户名/密码来限制。
说明如下:
解释---------------------------------------------------------------------------
<Location /svn>
意味着可以通过像这样的URL(http://localhost/svn)来访问Subversion版本库
DAV svn 告诉Apache哪个模块负责服务像那样的URL--在这里就是Subversion模块
SVNListParentPath on 在Subversion 1.3及更高版本中,这个指示器使得Subversion列出由SVNParentPath指定的目录下所有的版本库
SVNParentPath C:\SVN 告诉Subversion在目录g:\SVN下寻找版本库 #(修改成你自己的目录)
AuthType Basic 启用基本的验证,比如用户名/密码
AuthName "Subversion repositories" 当一个验证对话框弹出时,告诉用户这个验证是用来做什么的
AuthUserFile "C:\Program Files\Apache SoftwareFoundation\Apache2.2\bin\passwd" #用户和密码文件,不是文件夹
指定C:\Program Files\Apache Software Foundation\Apache2.2\bin\passwd用为密码文件用来验证用户的用户名及密码
AuthzSVNAccessFile C:\SVN\test\conf\authz指定C:\SVN\test\conf\authz来限定各个用户或组在版本库中目录的访问权限
Require valid-user限定用户只有输入正确的用户名及密码后才能访问这个路径
解释-----------------------------------------------------------------------------
(3) 创建passwd文件
打开命令行(DOS窗口CMD),
将当前目录切换到apache2.2目录(通常为C:\Program Files\Apache Software Foundation\Apache2.2\bin\),
输入命令:
htpasswd.exe -c passwd admin
Automatically using MD5 format.
New password: ****** (输入密码)
Re-type new password: ******
Adding password for user admin
重启Apache服务。
重启后打开http://localhost/svn/ 输入密码后,还是出错(因为还没有建立版本库,我们将在TortoiseSVN 项目管理中提到)
Forbidden
You don't have permission to access /svn on this server.
--------------------------------------------------------------------------------
(4) TortoiseSVN安装
按提示安装完成,需重启电脑
(5) SVN项目设置
(1).打开资源管理器,在C:\SVN目录下新建test目录
(2).在test文件夹上右击TortoiseSVN--->Create repository here...
(也可以通过命令的方式:到SVN的安装BIN目录。运行:svnadmin create C:\svn\test
c:\svn目录需先建好,要不会出错:svnadmin: 档案库创建失败svnadmin: 无法创建最上层目录)
(3)保持版本库默认为(FSFS)
(4).到项目文件夹(test)上,右击TortoiseSVN-->import...
在URL of repository:中输入http://localhost/svn/test
(5).项目成员,可在自己机上新建一个空的项目文件夹.右击SVN checkout...
在提示的用户名和密码对话框中输入服务端配置的用户名和密码;然后点击OK;后面对话框中即会显示逐个加入的文件和目录信息,最后一条显示“Completed At Version 1”。
如果成功,可以在本地目录下看到相应的代码文件。选中文件或目录,可以进行“SVN Update”(从服务器更新版本)和“Svn Commit”(提交更改到服务器)操作。
(6) 权限配置
(1)修改svn版本库目录下的3个文件
authz文件:
### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
### - a single user,
### - a group of users defined in a special [groups] section,
### - an alias defined in a special [aliases] section,
### - all authenticated users, using the '$authenticated' token,
### - only anonymous users, using the '$anonymous' token,
### - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = admin
user = user
test = test
[/]
@admin = rw
qd = r
bu = r
[/QD]
@admin = rw
qd = r
bu = r
[/BU]
@admin = rw
qd = r
bu = rw
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
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 = none
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 conf directory.
### 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 conf
### directory. 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
通过上面的设置,admin对根目录具有可读可写的权限,bu和qd用户对根目录具有可读的权限。bu和qd对本身的目录具有可读可写的权限,对于其它目录可读。
备注
1.当服务都配好之后,可以到apache的log目录下查看error.log文件,是否有帮助