当前位置: 主页 > 操作系统 > 其他系统 > windows 2008配置SVN服务

windows 2008配置SVN服务

时间:2010-10-25来源:互联网 点击:

一、安装SVN
1. 下载

SVN服务器下载地址: http://subversion.tigris.org/servlets/ProjectDocumentList

SVN客户端下载地址: http://tortoisesvn.tigris.org/

2. 安装

SVN服务器安装地址为 D:\Subversion

二、配置版本库
1. 建立版本库

首先在D盘新建VersionLib文件夹

然后在命令行窗口中输入:

svnadmin create D:\VersionLib\MyProject

2. 配置版本库

   进入版本库目录,本文中是D:\VersionLib\MyProject

   在conf目录下可以看到svnserve.conf和passwd两个文件

   对两个文件作以下修改

 

svnserve.conf文件

[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 = read                                                                                                                 
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                                                                                                        

 

# anon-access = read                                anon-access = read

# auth-access = write              修改为          auth-access = write

# password-db = passwd                                  password-db = passwd

anon-access = read、auth-access = write有#,一定要去掉,不要有空格。其中前两行表示读写访问权限,最后一行表示密码文件使用默认的passwd文件,如果你使用其他文件,则改为你使用的文件名。

passwd文件

[users]                                                                        
# harry = harryssecret                                                         
# sally = sallyssecret                                                                                                               
wen = 123456                                                                                                                        

这表示添加了一个用户,用户名为wen,密码为123456,可以添加多个用户。

三、注册Subversion服务
方法一

1. 如果SVN服务器安装在D:\Subversion,版本库在D:\VersionLib\MyProject,为了使SVN服务能够随Windows启动而启动,需要键入以下命令

sc create svnservice

binpath= “D:\Subversion\bin\svnserve.exe --service -r D:\VersionLib\Myproject” 
 

displayname= “SVNService”

depend= Tcpip

start= auto

另外还有三点需要小心处理。首先,service前是两个‘-‘,r前是一个‘-‘;其次,如果路径中包括空格,一定要用“”处理“"”号,例如上面的例子中如果svnserve.exe在”D:\Program files\Subversion”中,则命令应该写为binpath= ""D:\Program files\Subversion\bin\svnserve.exe"”(“”中的内容),整个命令如下,橙色部分是改变部分:

sc create svnservice

binpath= “"D:\Program files\Subversion\bin\svnserve.exe" --service -r D:\VersionLib\Myproject”

displayname= “SVNService”

depend= Tcpip

start= auto


其次,sc对选项的格式还有要求,例如“depend= Tcpip”不能写为“depend = Tcpip”或“depend=Tcpip”,也就是“=”前不能有空各,而后面必须有空格。

 

2. 在命令行窗口执行完以上这个命令之后,可以在服务器管理器 -> 配置 -> 高级安全Windows防火墙 -> 服务 下查看svnservice是否已启动。

若服务还没有启动,可以在命令行窗口运行

net start svnservice 启动这个服务

net stop svnservice 停止这个服务

 

3. 删除服务

   sc delete svnservice

 

方法二

命令行窗口输入命令

svnserve –d –r D:\VersionLib\MyProject

这样就以守护的方式启动了Subversion服务器了,注意不要关闭命令行窗口,关闭窗口也会把Subversion服务停止掉。

四、启动Subversion
在TortoiseSVN客户端输入url地址svn://IP地址/版本库名,本文中为svn://localhost/MyProject

五、Windows Server 2008配置防火墙端口
默认情况下Windows Server 2008对Subversion的端口是未打开的,Subversion的默认端口是3690,如果不幸这个端口被别的程序占用,可以通过选项 –listen-port= 绑定端口。

打开端口操作:

服务器管理器 -> 配置 -> 高级安全Windows防火墙

1.入站规则,在右边的操作栏选择新建规则

端口 -> 特定本地端口(输入3690)-> 允许连接 ->(默认)-> 名称(SVNService)-> 完成

2.出站规则,在右边的操作栏选择新建规则

端口 -> 特定本地端口(输入3690)-> 允许连接 ->(默认)-> 名称(SVNService)-> 完成

站长资讯网
. TAG: windows 2008 SVN服务
推荐内容最近更新人气排行
关于我们 | 友情链接 | 网址推荐 | 常用资讯 | 网站地图 | RSS | 留言