WINXP+SVN+APACHE(含一些问题解决)

  • 格式:pdf
  • 大小:98.21 KB
  • 文档页数:7

查看文章winxp+svn+apache2009-09-2216:43环境:Windows XP SP3专业版Setup-Subversion-1.6.4.msi服务器端TortoiseSVN-1.6.3.16613-win32-svn-1.6.3.rar客户端apache_2.2.3-win32-x86-no_ssl.msi步骤:1、安装程序与下载说明1、Apache Web服务器:/download.cgi (我下载的是apache_2.2.3-win32-x86-no_ssl.msi)Subversion:(/,去这里找吧)TortoiseSVN客户端工具(TortoiseSVN-1.6.3.16613-win32-svn-1.6.3.rar)2、程序安装(1)apache安装:安装步骤就不说了,简单。

需要注意的一点就是检查本机的iis端口号不要和apache冲突,此apache包的默认端口是80。

安装完成后,打开http://loccalhost,如果能出现内容,那你的Apache就安装成功了。

(2)运行Subversion安装程序,如果安装程序能够识别你已经安装了Apache,那么你的安装基本上就OK了。

如果它不能(很幸运,我的不识别),那么你需要做以下手工配置:注:如果你先安装Apache,再安装Subversion,进入Sibversion的安装目录(默认为c:\program files\Subversion),找到文件httpd/mod_dav_svn.so、mod_authz_svn.so、libdb44.dll,将它们拷贝到Apache 的modules目录(我的为C:\Program Files\Apache SoftwareFoundation\Apache2.2\modules)。

编辑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.soLoadModule authz_svn_module modules/mod_authz_svn.so在配置文件的最后添加下面这些行:<Location/svn>SVNParentPath g:\svnAuthType BasicAuthName"Subversion repositories"#AuthzSVNAccessFile g:\svn\wwwAuthUserFile"C:\Program Files\Apache SoftwareFoundation\Apache2.2\bin\passwd"Require valid-user</Location>配置表示:你所有的版本库将位于G:\SVN目录下,要访问你的版本库可以使用这样的URL:http://localhost/svn/,访问权限将由passwd文件中的用户名/密码来限制。

说明如下:解释---------------------------------------------------------------------------<Location/svn>意味着可以通过像这样的URL(http://localhost/svn)来访问Subversion版本库DAV svn告诉Apache哪个模块负责服务像那样的URL--在这里就是Subversion模块SVNListParentPath on在Subversion1.3及更高版本中,这个指示器使得Subversion列出由SVNParentPath指定的目录下所有的版本库SVNParentPath g:\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 g:\svn\www指定g:\svn\www来限定各个用户或组在版本库中目录的访问权限Require valid-user限定用户只有输入正确的用户名及密码后才能访问这个路径解释---------------------------------------------------------------------创建passwd文件打开命令行(DOS窗口CMD),将当前目录切换到apache2.2目录(通常为C:\Program Files\Apache Software Foundation\Apache2.2\bin\),输入命令:htpasswd.exe-c passwd usernameAutomatically using MD5format.New password:******(输入密码)Re-type new password:******Adding password for user username重启Apache服务。

重启后打开http://localhost/svn/输入密码后,还是出错(因为还没有建立版本库,我们将在TortoiseSVN项目管理中提到)ForbiddenYou don't have permission to access/svn on this server.--------------------------------------------------------------------------------(3)TortoiseSVN按提示安装完成,需重启电脑3.SVN项目设置(1).打开资源管理器,在g:\SVN目录下新建www目录(2).在WWW文件夹上右击TortoiseSVN--->Create repository here...(也可以通过命令的方式:到SVN的安装BIN目录。

运行:svnadmin create g:\svn\wwwg:\svn目录需先建好,要不会出错:svnadmin:档案库创建失败svnadmin:无法创建最上层目录(3).然后选择Native filesystem(FSFS)(4).到项目文件夹(www)上,右击TortoiseSVN-->import...在URL of repository:中输入http://localhost/svn/www(5).项目成员,可在自己机上新建一个空的项目文件夹.右击SVN checkout...在提示的用户名和密码对话框中输入服务端配置的用户名和密码;然后点击OK;后面对话框中即会显示逐个加入的文件和目录信息,最后一条显示“Completed At Version1”。

如果成功,可以在本地目录下看到相应的代码文件。

选中文件或目录,可以进行“SVN Update”(从服务器更新版本)和“Svn Commit”(提交更改到服务器)操作。

4、权限配置(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,&joeadmin=adminuser=user#test=test[/]@admin=rwqd=rbu=r[/QD]@admin=rwqd=rbu=r[/BU]@admin=rwqd=rbu=rw#[/foo/bar]#harry=rw#&joe=r#*=#[repository:/baz/fuz]#@harry_and_sally=rw#*=rsvnserve.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 /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=noneauth-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用户对根目录具有可读的权限。