windows 下架设subversion服务器

·
一、安装
下载
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91

如:安装到 D:\deploy\Subversion

二、建立Repository

打开命令窗口, 键入 :
    svnadmin create --fs-type fsfs G:\svnsrc\game

三、配置Repository

进入Repository目录,在本文中是 G:\svnsrc\game
,你会看到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

passwd
[users]
# harry = harryssecret
# sally = sallyssecret
alpha=123456


svnserve.conf中的[general] 和 passwd 中的 [users]  行前有#,一定要去掉,不要有空格


四、启动subversion

打开命令窗口键入
     svnserve -d -r G:\svnsrc

默认端口是3690,如果不幸这个端口被别的程序暂用,可以通过选项 --listen-port=绑定端口

url格式为  svn://ip地址//Repository 名,在本文中是svn://127.0.0.1/game



======

将Subversion安装成service。让 subversion在windows自动启动

以前的svnserve要想成为windows服务,必须依赖于svnservice或其他工具。从 Subversion1.4开始,Subversion本身就集成Windows服务的工具。


1,安装svnservice
在Windows NT中(包括Windows XP, Windows 2000, Windows 2003 Server)本身包含了一个安装服务的工具,叫做"Service Control",也就是sc.exe。

例如我的Subversion安装在"D:Subversion",版本库在"D:svnroot",而我希望对应的Subversion服务名为svnservice,安装这个svn服务的命令就可以这样写:

      sc create svnservice
      binpath= "D:Subversionbinsvnserve.exe --service -r D:svnroot"
      displayname= "SVNService"
      depend= Tcpip
     
请注意,因为便于察看,上面的命令分为多行,但在实际执行时应该在一行里。另外,在以前启动svnserve时会使用"-d"选项,也就是守护进程模式,在这里不能使用,会导致服务无法启动。同样,"-i"和"-t"选项也不能使用。

在命令行窗口执行完这个命令之后,服务还没有启动,你可以继续运行"net start svnservice"启动这个服务,然后使用"net stop svnservice"停止服务。

另外还有两点需要小心处理。首先,如果路径中包括空格,一定要用“\”处理“"”号,例如上面的例子中如果svnserve.exe在“c:program filessubversion”中,则命令应该写为“binpath= ""c:program filessubversionbinsvnserve.exe"”(“”中的内容),整个命令如下,红色部分是改变部分:

      sc create svnservice
      binpath= "\"D:program filesSubversionbinsvnserve.exe\" --service -r D:svnroot"
      displayname= "SVNService"
      depend= Tcpip
     
其次,sc对选项的格式还有要求,例如“depend= Tcpip”不能写为“depend = Tcpip”或“depend=Tcpip”,也就是“=”前不能有空各,而后面必须有空格。


2,删除服务
如果服务安装的有问题,你可能需要删除服务。要删除前面添加的服务,只需要运行"sc delete svnservice","svnservice"就是我们创建服务时使用的名字。


3,配置服务是自动启动
默认情况下安装的服务不会随Windows的启动而启动,为了使svn服务能够随Windows启动而启动,需要修改一下"sc create"命令(首先要删除),增加"start= auto"选项:

      sc create svnservice
      binpath= "D:Subversionbinsvnserve.exe --service -r D:svnroot"
      displayname= "SVNService"
      depend= Tcpip
      start= auto
     
当然你也可以使用图形化的工具修改服务的属性,你可以在“开始->运行...”中执行"services.msc",然后在界面中修改。

猜你喜欢

转载自moonshadows.iteye.com/blog/653118