安装和配置Windows下SVN开发环境

[b][size=large]简介[/size][/b]

本文介绍在WindowsXP(在Windows2003下应该也可以)安装SVN(subversion)及其相关集成工具。

实现如下功能:

[list]
[*]通过http访问版本控制器
[*]通过Web应用程序设置用户认证和授权
[/list]

[b][size=large]基本步骤[/size][/b]

[b][size=medium]安装Apache Http Server[/size][/b]

下载最新版本的Apache Http Server Windows安装包。

下载地址:[url]http://apache.mirror.phpchina.com/httpd/binaries/win32/apache_2.2.6-win32-x86-no_ssl.msi[/url]

通过安装向导默认安装即可。

[b][i]需要注意的是:[/i][/b] Network domain,Server name和Email address都必须填写适当的内容。

安装完成后,通过http://localhost访问成功即可。

[b][size=medium]安装SVN[/size][/b]

下载最新版本的Subversion安装包。

下载地址:[url]http://subversion.tigris.org/files/documents/15/39559/svn-1.4.5-setup.exe[/url]

默认安装即可。

检查是否安装成功,在命令行中,输入:


svn --version


显示版本号既成功。

[b][size=medium]创建一个svn repository[/size][/b]

创建svn repository(仓库)的根目录,比如[i]e:/svn[/i]。

在命令行下,进入[i]e:/svn[/i]。

输入如下命令:


svnadmin create documents


[b][size=medium]升级svn支持apache2.2[/size][/b]

svn默认1.4.5版本,是基于apache2.0编译的。

使用Microsoft Visual C++ 6.0。

apache2.2版本,基于更新的C++.net环境。

下载svn1.4.5针对apache2.2的分发包(没有安装包,所以麻烦一点)。

地址是:[url]http://subversion.tigris.org/downloads/1.4.5-win32/apache-2.2/svn-win32-1.4.5.zip[/url]

下载后,解压缩,并覆盖安装的svn目录即可。

[b][size=medium]SVN与Apache的集成[/size][/b]

将安装后svn的bin目录下所有后缀是so的文件复制到apache的modules目录下。

将安装后svn的bin目录下所有后缀是dll的文件复制到apache的bin目录下,[i]如果提示是否覆盖,一定注意不要覆盖apache目录下的dll,主要是apr方面的dll[/i]。

编辑[i]apache/conf/httpd.conf[/i]文件:

找到配置文件中的LoadModule dav_module modules/mod_dav.so和LoadModule dav_fs_module modules/mod_dav_fs.so,将该两行前的#号去掉;

在上述内容后加入:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so


在配置文件末尾添加如下内容:


<Location /svn>
<Location /svn>
DAV svn
SVNParentPath e:/svn

AuthType Basic
AuthName "Subversion Reporsitory"
AuthUserFile "D:/Program Files/Apache Software Foundation/Apache2.2/conf/svnpasswd"


AuthzSVNAccessFile "D:/Program Files/Apache Software Foundation/Apache2.2/conf/svnauthz"
Require valid-user
</Location>


重启apache即可。

创建svn用户,在命令行中,进入[i]D:/rogram Files/Apache Software Foundation/Apache2.2/bin[/i]目录,输入:


htpasswd -c ../conf/svnpasswd marshal


创建password文件,并且创建marshal用户。

在[i]conf[/i]目录下创建[i]svnauthz[/i]用于授权,以下是简单的文件内容:

[/]
marshal = rw


上述文件为刚创建的[i]marshal[/i]用户设置了对所有目录的读写的权限。

重启apache,并访问[url]http://localhost/svn/documents[/url]

如有问题,通过[i]apache/logs/error.log[/i]检查问题。


[b][size=medium]安装SVNManager[/size][/b]

安装svnmanager,用于通过web的方式:

[list]
[*]创建用户和修改密码
[*]创建和修改用户权限
[*]创建用户组和修改用户组的权限
[*]创建SVN库
[/list]

安装svnmanager,需要安装PHP环境和MySQL。

安装php环境,可参考:[url]http://marshal.iteye.com/blog/147139[/url]或者其他文档。

安装MySQL,本文使用MySQL 5.0.45安装包默认安装即可。

为svnmanager创建数据库:


create database svnmanager CHARACTER SET utf8;


svnmanager网址:[url]http://svnmanager.sourceforge.net/[/url]

svn需要PHP支持PEAR。

进入php的[i]PEAR[/i]目录,命令行输入:


php go-pear.phar


出现提示的时候,回车即可。

svn需要VersionControl_SVN,这需要通过PEAR安装:


pear install -a VersionControl_SVN-0.3.1


当前svnmanager版本是[i]1.03[/i]。

另外,需要修改php.ini文件,取消下列行的注释:


extension = php_mbstring.dll
extension = php_mysql.dll
extension = php_gb2.dll
extension = php_mysqli.dll
extension = php_pdo.dll
extension = php_pdo_mysql.dll


下载svnmanager,路径为:[url]http://sourceforge.net/project/showfiles.php?group_id=135933[/url]

在[i]apache/htdocs[/i]目录下,建一个目录[i]svnmanager[/i]。

将下载的文件解压缩到上述的[i]svnmanager[/i]中。

将[i]svnmanager[/i]目录中的config.php.win改名为[i]config.php[/i]。

修改文件中的内容如下:


<?php
//
// SVNManager config.php file for Windows based servers
//

$htpassword_cmd = "D:\\Program Files\\Apache Software Foundation\\Apache2.2\\bin\\htpasswd";
$svn_cmd = "D:\\Program Files\\Subversion\\bin\\svn";
$svnadmin_cmd = "D:\\Program Files\\Subversion\\bin\\svnadmin";

//Subversion locations
$svn_repos_loc = "e:\\svn";
$svn_passwd_file = "D:\\Program Files\\Apache Software Foundation\\Apache2.2\\conf\\svnpasswd";
$svn_access_file = "D:\\Program Files\\Apache Software Foundation\\Apache2.2\\conf\\svnauthz";

//If the following is set, removing a repository will cause it to be
//moved to this location rather than being deleted.
$svn_trash_loc = "";

// If $svnserve_user_file is defined, then SVNManager will create a
// user/password file suitable for use with SVNSERVE
//
// When not set, this feature isn't enabled.
//
// Warning: When enabled, this mode requires that passwords are stored in the database readable!
//
// Note: When is feature is enabled later, passwords need to be re-set before they are included in
// the svnserve user file.
//
//$svnserve_user_file = "c:\\svn\\svnserve_passwd_file";
$svnserve_user_file = "";

//SMTP Server for outgoing mail
$smtp_server = "smtp.mailserver.net";


//Data Source Name (only tested with mysql and sqlite databases!!)
//
//Either:
//
//Use the createtables.sql script to build the tables in a mysql database
//
// or
//
//An empty SQLite database will automatically be generated with the first
//startup!
//
//Please note that if you change the directory for a SQLite database that you
//choose a location that is not accessible via web!!
//

$dsn = "mysql://root:password@localhost/svnmanager";

//$dsn = "mysql://svnmanager:svnmgmpw@localhost/svnmanager";
//The following location is not readable from internet by means of an .htaccess file
//$dsn = "sqlite://svnmanager\\svnmanager.db";

//Administrator account
//
//This account can be used to create a first administrator user.
//When an administrator user is added, this account doesn't work
//anymore!
//
$admin_name = "admin";
$admin_temp_password = "admin";

// If $post_create_script is defined, then this script / command will be
// executed after a repository is created.
// When the script/command is executed the one and only parameter will be
// the physical location of the repository.
// This might copy a default set of hooks or config files
//
// $post_create_script = "svn-update-config-files.bat";

?>


重启apache,然后通过[url]http://localhost/svnmanager[/url]访问。

用户名/密码都是:admin

创建第一个用户,通过user admin链接,点击add按钮。

注意构选admin复选项。

通过刚刚创建的用户登录,就可以看到各种功能的链接。

以后就可以通过该界面创建用户和权限了,而不需要再通过svn和apache的命令和配置文件了。

另外,可下载中文汉化包,见:[url]http://bbs.iusesvn.com/viewthread.php?tid=2122[/url]

本文最早由本人(marshal@javaeye)发表在:http://marshal.easymorse.com/blog/archives/161
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值