Monday, June 8, 2009

install svn on windows

Setting up a Subversion Server under Windows

I talked a little bit about what Subversion is in my previous post. Now, let's get it set it up in Windows.

Luckily for us, Joe White has done most of the work already; he has a tremendously helpful post that documents how to set up Subversion. I'll see if I can streamline his excellent post a bit further, and illustrate it with screenshots.

A) Download Subversion

You'll need the latest version of..

* the Windows binaries
* the "run Subversion as a windows service" wrapper
* the TortoiseSVN shell integration utility

B) Install Subversion

1. Unzip the Windows binaries to a folder of your choice. I chose c:\program files\subversion\ as my path.
2. Now, add the subversion binaries to the path environment variable for the machine. I used %programfiles%\subversion\bin\

3. You'll also need another environment variable, SVN_EDITOR, set to the text editor of your choice. I used c:\windows\notepad.exe

C) Create a Repository

1. Open a command prompt and type

svnadmin create "c:\Documents and Settings\Subversion Repository"

2. Navigate to the folder we just created. Within that folder, uncomment the following lines in the /conf/svnserve.conf file:

[general]
anon-access = read
auth-access = write
password-db = passwd

Next, uncomment these lines in the /conf/passwd file:

[users]
harry = harryssecret
sally = sallyssecret

D) Verify that everything is working

1. Start the subversion server by issuing this command in the command window:

svnserve --daemon --root "C:\Documents and Settings\Subversion Repository"

2.

Create a project by opening a second command window and entering this command:

svn mkdir svn://localhost/myproject

It's a standard Subversion convention to have three folders at the root of a project:

/trunk
/branches
/tags

3.

At this point, Notepad should launch:

Enter any comment you want at the top of the file, then save and exit.

4.

You'll now be prompted for credentials. In my case I was prompted for the administrator credentials as well:

Authentication realm: 0f1a8b11-d50b-344d-9dc7-0d9ba12e22df
Password for 'Administrator': *********
Authentication realm: 0f1a8b11-d50b-344d-9dc7-0d9ba12e22df
Username: sally
Password for 'sally': ************

Committed revision 1.

Congratulations! You just checked a change into Subversion!

E) Start the server as a service

1. Stop the existing command window that's running svnserve by pressing CTRL+C.
2. Copy the file SVNService.exe from the zip file of the same name to the subversion\bin folder.
3. Install the service by issuing the following commands:

svnservice -install --daemon --root "C:\Documents and Settings\Subversion Repository"
sc config svnservice start= auto
net start svnservice

4. Test the new service by listing all the files in the repository:

svn ls svn://localhost/

You should see the single project we created earlier, myproject/

F) Set up the shell extension

1. Run the TortoiseSVN installer. It will tell you to restart, but you don't need to.
2. Create a project folder somewhere on your hard drive. Right click in that folder and select "SVN Checkout..."



type svn://localhost/myproject/ for the repository URL and click OK.


3. Create a new file in that directory. Right click the file and select "TortoiseSVN, Add"


4. The file hasn't actually been checked in yet. Subversion batches any changes and commits them as one atomic operation. To send all your changes to the server, right click and select "SVN Commit":



And we're done! You now have a networked Subversion server and client set up on your machine. Note that the default port for svnserve is 3690.


CHINESE VERSION:

SubVersion服务器Windows安装指南
SubVersion及TortoiseSVN下载请到其官方网站:http://subversion.tigris.org
注:如果要使用TortoiseSVN中文界面,还要下载其语言安装包. 若只在本地计算机上使用,不使用SubVersion服务,则只需安装TortoiseSVN相关组件即可.

一.下载文件列表:

1.SubVersion 点击这里下载,版本是1.3.0,SubVersion服务程序.

2.TortoiseSVN 点击这里下载,版本是1.3.2,SubVersion客户端程序.

3.TortoiseSVN 中文语言包 点击这里下载,版本与上面的匹配.

4.SVNService 点击这里下载,可以将SubVersion服务包装成Windows NT服务.

二.安装步骤

1.安装SubVersion

2.安装TortoiseSVN及语言包

3.配置SubVersion服务

SubVersion本身是由命令行启动的,在SubVersion安装目录中找到,它不能像Windows NT服务一样随Windows启动,需要借SVNService来包装成Windows NT服务.具体设置如下:

将下载的SVNService解包后,将其中的拷贝到SubVersion的安装目录中的\bin目录, 保证SVNService.exe和svnserve.exe在同一目录.

安装服务:
运行命令:SVNService -install -d -r
在实际操作中,代表SubVersion服务的电子仓库目录.

改变服务设置:
运行命令:SVNService -setup -d -r
在实际操作中,代表与SubVersion服务启动时不同的电子仓库目录.

删除服务:
运行命令:SVNService -remove

4.用TortoiseSVN创建电子仓库

TortoiseSVN客户端不是独立的程序,而是与Windows Explorer进行了外壳集成,其操作通过环境菜单来完成.



如上图所示:
1.创建名为SVNroot的空目录
2在目录上,或在在目录内空白处点右键,从TortoiseSVN菜单中选择Create repository here...(在此处创建电子仓库),在选择电子仓库类型后,将会自动生成一些文件和目录.这样就完成了电子仓库的创建,你可以用同样的方法创建多个电子仓库.

注:电子仓库类型有两种可供选择,选择任意一种即可:
1.Native filesystem(FSFS) 本地文件系统
2.Berkely database(BDB) Berkely数据库
不同的选择只会影响电子仓库的数据存取格式,默认选择为:Native filesystem

在本例中,可以用:SVNService -install -d -r e:\svnroot来安装SubVersion服务

要问本机安装的服务请在右键菜单中选择Reop-browser(电子仓库浏览),弹出如下对话框:

1 comment:

Alwin Co Daan said...

This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Javascript Training in Chennai . or learn thru JavaScript Online Training India. Nowadays JavaScript has tons of job opportunities on various vertical industry.