在 Windows 上安装 SVN Subversion 服务端

现在的Subversion已经足够稳定,而且已经进入了它的黄金时段。我们看到大量的项目都在使用它完成版本控件的工作。本文将主要针对Windows平台讲述安装Subversion服务器的步骤。本文所使用的环境是如下

操作系统

Windows XP Professional SP2

尽量使用原版,因为有朋友反映在部分类似番茄花园的盗版XP上,由于内部文件做过优化,导致Subversion服务端软件异常。

服务端软件

Setup-Subversion-1.6.5.msi

Windows MSI installer with the basic win32 binaries - includes binaries for Apache 2.2.x (2.2.9 or higher is required within the 2.2.x series)

客户端软件

TortoiseSVN-1.6.5.16974-win32-svn-1.6.5.msi

常用的GUI客户端

客户端软件

Slik-Subversion-1.6.5-win32.msi

命令行工具,如果你习惯用cvs的命令行,那这个你会很适应

Subversion的主页是http://subversion.tigris.org/ 或者你也可以直接点击这里下载 Setup-Subversion-1.6.5.msi
TortoiseSVN
的主页是 http://tortoisesvn.tigris.org/ 你也可以直接点击这里下载TortoiseSVN-1.6.5.16974-win32-svn-1.6.5.msi

首先我们安装运行Setup-Subversion-1.6.5.msi安装界面比较简单,我们主要关注安装位置,假定我们安装在默认位置C:/Program Files/Subversion
现在我们创建repository,使用的命令是svnadmin。本例中,我们要在c:/svnroot下建立repository。那么我们使用的命令行如下:

C:/Program Files/Subversion/bin>svnadmin create c:/svnroot
C:/Program Files/Subversion/bin>

建立好repository之后,我们要对Server进行一些简单的配置。打开c:/svnroot下的conf目录,编辑svnserve.conf,修改里面的内容。
auth-access = write
password-db = passwd
anon-access = read
前面的#去掉,打开这个注释。
同时修改anon-access= none
现在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 = none
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 directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
### The authz-db option controls the location of the authorization
### rules for path-based access control. Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file. If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
# authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa. The default realm
### is repository's uuid.
# realm = My First Repository

修改好svnserve.conf后,我们再修改 passwd文件。加入我们需要的用户名joe和口令123passwd内容如下:

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret
joe = 123

现在就可以启动server了。启动的方法有很多种,在这里针对本文的环境我们介绍两种,一种是以deamon方式调用,一种是以Windows Service的方式调用。
如果是以deamon的方式调用,那么命令行如下:

C:/Program Files/Subversion/bin>svnserve -d -r c:/svnroot

    服务端开始运行后,我们就可以关注一下客户端的问题了。TortoiseSVN的安装我没有什么可说的,就是一路的NEXT。这里我们描述一下我们的用于test的项目。以本文为例假定我们的项目目录是D:/mytemp/svn_test1,假定目录下有一个test1.txt文件。在svn_test1上按右键选TortoiseSVN-->ImportURL ofrepository里输入svn://192.168.159.129/svnroot点击OK后,按提示输入用户名和口令,就可以把项目导入Subversion。好了,现在我们可以试一下,看看刚才我们导入的内容,并开始正常的update,commit工作吧。我们删除svn_test1里面的所有文件。然后在svn_test1目录上按右键选SVN Checkout URL of repository里输入的仍是svn://192.168.159.129/svnrootCheckout directory里输入的是D:/mytemp/svn_test1 Checkout Depth选择Fullyrecursive,点击OK后,按提示输入用户名和口令,这时我们再看svn_test1目录,就可以看到我们导出的test1.txt文件了。

    我们打开test1.txt文件尝试修改并更新一下。我们在test1.txt里加上一行哈尔滨市,高宏伟QQ:21807822”,然后我们在svn_test1目录上按右键选svncommit,在message中我们可以输入一些日志来标志本次修改,然后点击OK,按提示输入用户名口令就可以提交了。update的操作也是类似,只不过是相反的操作。

    界面的操作不太容易用文字来表达,但界面很直观,相信大家摆弄摆弄就可以搞定。刚才为了保证文章的连续性,我们没有说明如何以Windows Service的方式来调用server。生成svn服务的命令如下:

C:/>sc create svn binpath= "C:/Program Files/Subversion/bin/svnserve.exe --service -r c:/svnroot" displayname= "Subversion Server" depend= tcpip start= auto
C:/>net start svn

这里要特别注意一下sc命令的使用。主要是注意一下=号后面的空格和svn路径的空格。
1.
如果你没有创建服务成功,那你就不要安装到Program Files目录下,因为它带了一个空格,你可以安装到一个比较简单的目录下再试试,如c:/svn_server
2.
如果安装到这样简单的目录还不能创建成。那你要注意binpath的等号后面有一个空格。你一定要完全按照上面的格式来写。
3.
实在不行你就把所有的环境先都配成和本文一样,然后再直接粘贴过去,这样可以保证你运行成功。等所有的问题都没有了。你再按照你的想像重新安装一次,看看你的问题出在哪儿,这样也好有个对比。
关于Slik-Subversion我在这里就先不做探讨了,它是一个命令行工具。一般来说GUI就可以满足你的简单需要。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值