首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > CVS SVN >

筹建svn服务器

2012-06-28 
搭建svn服务器Subversion for Windows 安装指南 1,下载软件1.1到 http://httpd.apache.org/ 下载 Apache H

搭建svn服务器
Subversion for Windows 安装指南
1,下载软件
1.1到 http://httpd.apache.org/ 下载 Apache HTTP Server 2.0 版 for Windows 的安装程序,我下载的文件是 Apache_2.0.63-win32-x86-no_ssl.msi
1.2到http://subversion.apache.org/packages.html下载Subversion.
1.3到http://dl.pconline.com.cn/download/53122.html下载TortoiseSVN
2,安装软件
2.1安装Server.点击安装.自动安装就好。安装目录为C:\Program Files\Apache Software Foundation\Apache2.2.这里以<Apache_root>称呼该目录。
安装Subversion.点击安装,自动安装就好。安装目录为C:\Program Files\Subversion;这里以<Subversion_root>称呼该目录。
2.2把 <Subversion_root>/bin/ 目录下的 mod_dav_svn.so 和 mod_authz_svn.so 复制到 <Apache_root>/modules/ 目录下
2.3把 <Subversion_root>/bin/ 目录下的 libdb44.dll、libeay32.dll、以及 ssleay32.dll 复制到 <Apache_root> 底下的 bin 或 modules 目录下。
2.4接着用文本编辑器打开 Apache HTTP Server 的<Apache_root>/conf/httpd.conf,寻找一堆 LoadModule 指令,先找到:
#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
2.5将C:\Program Files\Subversion\bin放到环境变量path里;
2.6重新启动 Apache HTTP Server
3,建立版本库(Repository)
3.1  在D:盘下新建一个目录,命名为svn作为文件库使用。
3.2  在svn新建文件夹java,形成如下文件d:/svn/java
3.3  新建文件夹project1和project2,并确保其为空文件夹。这里假设要发布project1和project2
执行命令
svnadmin create D:\svn\java\project1
svnadmin create D:\svn\java\project2
3.4 在d:/svn目录下新建文件httpd.conf,并在C:\Program Files\Apache Software Foundation\Apache2.2\conf\ httpd.conf里添加Include部分添加 Include D:/svn/httpd.conf。httpd.conf里面的内容为:
<Location /svn/project1>
DAV svn
SVNPath d:/svn/java/project1
</Location>
<Location /svn/project2>
DAV svn
SVNPath d:/svn/java/project2
</Location>
3.5 访问路径http://localhost/svn/project1/,http://localhost/svn/project2/可以查看相应的信息。
3.6 导入初始化项目。找到要导入的项目。使用工具TortoiseSVN去完成导入工作,很简单。选择导入import,在出现的图形界面中添加路径为http://localhost/svn/project1/ 。等待导入成功oK就可以了。或cmd进入项目路径下,执行下列命令svn import . http://localhost/svn/project1 -m "Initial repository layout"
3.7  添加用户。在d:/svn目录下新建文件svn-auth-file,然后创建用户Harry和Sally。运行命令如下。
cd C:\Program Files\Apache Software Foundation\Apache2.2\bin
C:\Program Files\Apache Software Foundation\Apache2.2\bin>htpasswd -cm D:\svn\svn-auth-file harry
New password: *****
Re-type new password: *****
Adding password for user harry
注意
When using the command for the first time, add the -c option. This creates the file named C:\etc\svn-auth-file .
The -m option instructs the htpasswd utility to use MD5 algorithm to encrypt the passwords
继续添加用户
C:\Program Files\Apache Software Foundation\Apache2.2\bin>htpasswd -m C:\etc\svn-auth-file sally
New password: *******
Re-type new password: *******
Adding password for user sally

C:\Program Files\Apache Software Foundation\Apache2.2\bin>htpasswd -m C:\etc\svn-auth-file ross
New password: *****
Re-type new password: *****
Adding password for user ross

C:\Program Files\Apache Software Foundation\Apache2.2\bin>htpasswd -m C:\etc\svn-auth-file rachel
New password: *****
Re-type new password: *****
Adding password for user Rachel
3.8 设置用户权限.新建svn-acl文件,内容如下
#
# specify groups here
#
[groups]
team1 = ross, rachel

#
# team1 group has a read/write access to project1 repository
# all subdirectories
# all others have read access only
#
[project1:/]
@team1 = rw
* = r

#
# project2 repository, only harry and sally have read-write access to project2
#
[project2:/]
harry = rw
sally = rw
* = r

#
# ross is helping with the time zone part of the project2
#
[project2:/timezone]
harry = rw
sally = rw
ross = rw
* = r
3.9 重新修改d:/svn/httpd.conf文件内容为:
<Location  /svn/project1>
  DAV svn
  SVNPath d:/svn/java/project1

  AuthType Basic
  AuthName "Subversion Project1 repository"
  AuthUserFile d:/svn/svn-auth-file

  Require valid-user

  AuthzSVNAccessFile d:/svn/svn-acl
</Location>
Location  /svn/project2>
  DAV svn
  SVNPath d:/svn/java/project1

  AuthType Basic
  AuthName "Subversion Project2 repository"
  AuthUserFiled:/svn/svn-auth-file
  Require valid-user
  AuthzSVNAccessFile d:/svn/svn-acl
</Location>
3.10 eclipse导入路径为http://ip/svn/sys

热点排行