您的位置:首页 > 其它

Windows Server 2008 安装与配置Subversion(SVN)服务器

2013-06-14 17:59 459 查看
服务器环境是 Windows Server 2008 R2 Standard

SVN 服务端软件 Subversion-1.6.3.msi

SVN 客户端软件 TortoiseSVN-1.6.8.msi

一、安装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)->
完成
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: