For a long time I've wanted to start using Subversion. I see all the benefits of using such a system, but I haven't taken the time to learn it. I've installed it (v1.3.2) a long time ago, but I never really did anything with it -- it was simply so I could interact with SmartSVN (a SVN client) to download others' repositories. I think it's about time I start using it in a more meaningful way on my own projects. In order to do this, I thought it would be best to start from scratch (and therefore uninstalled all previous, remotely related software). (For further learning on SVN, please visit Red-Bean's SVN Book online.)

So, it had been so long since I've done anything with Subversion, where was I to begin? I've read about all the great and wonderful things SVN can offer, but...how do I get it, how do I install it, and then how can I access it?
Edit: UPDATE! If you don't want to do all the work yourself, you can now use an all-in-one installation package. VisualSVN Server/ will install Apache, Subversion, and a management console for the Windows' platform.

Perfect timing! Shane Bauer, a Microsoft Certified Engineer (MCE) in ASP.NET, decided to take time out of his day to answer someone else's question on the matter in a forum that I frequently visit. (Link to the topic.) If you'd prefer pictures (but ignore the "run as service" portion) follow the steps on Vertigo Software's instructions.

The following is basically a cut and paste of Shane's post, simply because it was well written:
Subversion is a great product. In fact, I hooked it up to Apache in my home environment as well as my work's environment. After using it for a while my only reaction is: wow. Subversion is awesome. Adding Apache just makes in that much nicer.

Setup is actually pretty straightforward. To use SVN in standalone mode (without Apache), just download the installer (I used svn-1.4.2-setup.exe).

Installing Subversion
- Double-click on the installer and run through it. Shouldn't take too long. Once installed, add an environment variable for SVN_EDITOR. You can do this by right-click on my Computer > Properties. Go to advanced. Hit the Environmental Variables button. Just add another in there called SVN_EDITOR with a value of C:\windows\notepad.exe

Creating a Repository
- Now you need to create a repository. Go to the command prompt (Start > run > cmd). type "svnadmin create D:\Programming\MySVNRepos". (Change the path to whatever path you want to use.) The repos is basically a special directory that will hold your files as well as various subversion config options.

Modifying Security and Authentication Settings
- Next up, you need to modify the permissions and users. Navigate to the folder you just created. In my example, I used D:\Programming\MySVNRepos". In this directory, you will find a few folders. One folder will be called conf. Navigate to it and double-click on the svnserv.conf file. Opening it with notepad will be fine.

- The svnserv.conf file in a configuration file for the svnserv executible. For our purposes, just uncomment out the following lines:

- Save your changes. And double-click on the passwd file in the same directory. The file stores all usernames and passwords in the format:

$username = $password

- Make sure the [Users] line is uncommented and you can just add a new line for your username and password. For example, if you wanted your username to be josh and your password to be testing, just create a line like this:

josh = testing

- Save it and you're done configuring.

Serving Your Repos for the First Time
Now, you can test it out. Go to the command prompt again and type:


Change the path to your specified path. Once this is done, the daemon should be listening and waiting for requests.

Creating your First Project folder
- Next, we can create a project folder in subversion. To do this, open up a new command prompt. We can't use the old one as our daemon will shutdown. Once you're in the new window, type the following:



- Once you type this in, notepad will appear (assuming you set the SVN_EDITOR variable at the very beginning). This is basically used for the log so you can just leave it be for our test example and close it out.

- After you close out notepad, subversion will ask for your username and password. However, keep in mind, it may also ask for your computer's Admin password. If it does, you can simply type in your computer's admin password. Once you hit return, you can then go ahead and type in your subversion username and then your subversion password. Your subversion username and password is exactly what you typed in the passwd file. (i.e. user: josh pass:testing)

- If you've successfully typed in your username and password, it should say Commited Revision 1. This is a good thing.

Finishing Up
- After that's completed, you're basically done. Your subversion repos has been setup. However, we have a few problems.
  1. You probably don't want the command window up all the time when running your subversion daemon.
  2. Accessing subversion via command prompt is ok, but it could be better.

Running svnserv as a Windows Service
If you're running XP (Win2k, Win2k3, or Vista), you can tell the process to run as a service. Stop your existing svnserv daemon by closing out of the existing command prompt window. Now, go to the command prompt (again). Type:


Ed. Note: The key/value pairs must be in the form key=_value where the underscore is representative of a space. Also, if you mess up here and the service is still installed, you will need to uninstall the service. You can do so by using sc delete svnrepos (or whatever service name you used). You will need to log off and back on for the service to be completely uninstalled. Also, the "Subversion Repository" is simply a label, you may also call this whatever you'd like.

This simply creates a new service in Windows. Of course, you will need to replace "D:\Programming\MySVNRepos" with the path to your repos that you created. Assuming that you install subversion in the default location, you should just have to run that. Now, just start it by typing:
net start svnrepos


You're done. If you want to change some service settings, such as turning on auto start, just go to Start > run. Type services.msc. Find the service with the Display Name set to "Subversion Repository", right-click on it and select Properties. You can change a few different things in there.

Download TortoiseSVN
Go to tortoisesvn.tigris.org and download TortoiseSVN. The tool is essentially a Windows shell extension that allows you to execute SVN commands from Windows Explorer. It's, honestly, the only subversion tool you really need if you're on a Windows computer. Once you install this, you can then view your repos via a tree view type situation.

For example, go to start > run and type:
svn://localhost

If your service/daemon is started, you should be able to expand the nodes to view your projects and files. You can also create new folders and do a plethora of different tasks in it as well. Also, if you go into Windows explorer, and right-click on any folder, you'll see a new TortoiseSVN submenu, with a few different options. You can then easily import an entire project folder into subversion with ease.

That's It!

Well, now it's time for me to go figure out how to integrate Apache 2.2 with SVN, if at all possible...or get Trac installed since I have that too. :-)

Trackbacks


Trackback specific URI for this entry
    Setting up SVN on Windows 2003
    I found the following very useful information on how to set up SVN on a Windows 2003 server. I found it http://life.mysiteonline.org/archives/67-Installing-and-Setting-up-Subversion-SVN-Under-Windows- ...
    Weblog: Darkware, Inc. Blog
    Tracked: Apr 20, 06:52
    ????? ??? ?????? ??????
    ?? ???? ???????? ?? ???? ???, ????? ???? ?? ???????, ????? ?????? ??? ????? ???????? - ?? ?????? ?????
    Weblog: Ohad Aston
    Tracked: May 18, 05:49
    גיבוי קוד וניהול גרסאות
    אם נושא הגיבויים לא חשוב לכם, כנראה שאתם לא מתכנתים, ובגלל שהבלוג הזה מיועד למתכנתים - אז החלטתי לכתוב
    Weblog: Ohad Aston - ASP.NET Blog
    Tracked: Jun 19, 08:56
    Weblog: georgi-mitev.com
    Tracked: Mar 07, 00:40

Comments


    #1 Morgan Hua on 04/22/07 at 04:17 PM [Reply]
    I was able to integrate with Apache 2.2.3

    Here's the additional articles needed to complete the installation:

    Win32 - SVN + Apache + Tortoise SVN + SVN Notify How-To (but uses wrong libraries):
    http://svn.haxx.se/users/archive-2006-05/att-0593/SVN-Apache-SVNNotify-HowTo-En.pdf

    Getting the right libraries for Apache 2.2.X
    http://subversion.open.collab.net/servlets/ProjectForumMessageView?forumID=42&messageID=783

    The SVN libraries compatible with Apache 2.2.x (mentioned in the article above, but really hard to find) are located here:
    http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100&expandFolder=8100&folderID=91
    http://subversion.tigris.org/files/documents/15/36104/svn-win32-1.4.3.zip

    Thanks for all your details, it helped a lot.
    #2 Brendon Kozlowski on 04/30/07 at 06:43 PM [Reply]
    Thank you both for the comments! They're quite helpful. Much appreciated!
    #2.1 Arun on 08/09/07 at 05:10 PM [Reply]
    Thanks for the detailed instructions. I'm having hardtime configuring Openssh with SVN on the server side. Here's my configuration - Subversion 1.44 on Windows 2003.

    Has anyone tried configuring SSH on SVN+Windows2003 server? Can you please pass on the instructions. Appreciate your help. Thanks.
    #2.1.1 Brendon Kozlowski on 08/15/07 at 07:56 AM [Reply]
    Arun, I apologize for not seeing your reply sooner. I still have not worked with Subversion all that much, even if I know I need to and keep saying I will. However, the following links may be of help to you:

    someone with similar problems - mailing list archive
    probably not as helpful - forum topic
    probably a good bet
    #2.2 Anoosha on 10/13/11 at 11:53 PM [Reply]
    Thank you for the the easy explanation....
    #3 venkat on 05/02/07 at 04:20 AM [Reply]
    about subversion details
    #4 Ing on 09/21/07 at 06:28 AM [Reply]
    Hello!

    Not able to install the service on Vista, getting access denied when typing in the lines .... I am the admin on this machine.
    Any suggestions ?
    #4.1 Brendon Kozlowski on 09/24/07 at 08:40 AM [Reply]
    Ing,

    I can only presume it has something to do with a user in the Administrator's Group not actually having the full rights as the real Administrator under Vista. I unfortunately do not have Vista installed on any of my PCs yet so am unable to test this out to find a workaround. However, you may find the following project to be helpful:
    SVN Automated Windows' Install
    I'm not sure if it's Vista compatible, but it can't hurt to try.
    #5 Sangharsha Bhattarai on 12/06/07 at 08:32 AM [Reply]
    Excellent one.
    I was looking for the svn setup instructions since long, and with this, my search ends.

    Thanks a lot Shane Bauer for the article, and Brendon Kozlowski for echoing it here.
    Great Job!
    #6 fabian mejia on 06/06/08 at 08:40 AM [Reply]
    Also, please check my page.
    I have added a small tutorial to instal a subversion package: VisualSVN for windows. It's really easy to setup:

    fabianmejia.blogspot.com
    #7 Brendon Kozlowski on 06/17/08 at 02:06 PM [Reply]
    Thank you for your comment, fabian!
    #8 tom on 07/21/08 at 05:37 AM [Reply]
    i have just done it on Vista, you ned to right click on command prompt and run as administrator.

    :)
    #9 husal on 09/09/08 at 01:49 PM [Reply]
    perfect, it help me a lot while setting SVN on my xP
    #10 lohith on 12/08/08 at 09:48 PM [Reply]
    Hi this lohith
    i am configuring the SVN
    i am un able to Creating a Repository
    how can i create repository
    #11 Brendon Kozlowski on 12/10/08 at 11:48 AM [Reply]
    Examples:
    Windows -
    svnadmin create C:/full/path/to/your/repository

    Linux:
    svnadmin create /usr/local/full/path/to/your/repository
    #12 Srinivas J Rao on 01/26/09 at 05:28 AM [Reply]
    Brendon,
    thank you. I followed these steps to setup on XP. perfect.
    #13 Brendon Kozlowski on 01/30/09 at 08:33 AM [Reply]
    You're quite welcome, Srinivas. If you reformat and get stuck and don't want to have to go through all of these steps, I would highly recommend VisualSVN, a free SVN server that is Windows based, using services and even installs its own administrative (GUI) tool to manage users, groups, and repositories. It's fully compatible with TortoiseSVN, though I haven't tested it against external Linux/Unix/OSX shell-based commands.
    #14 Madhan on 04/13/09 at 07:44 AM [Reply]
    Good work. A good place to start learning SVN
    it will be better if the command is fully visible under
    "Running svnserv as a Windows Service". I was not able to see that in IE 7 and FF 3
    #15 Brendon Kozlowski on 04/13/09 at 10:58 AM [Reply]
    Madhan, thanks for letting me know. This happened when I changed themes on my site. I believe using my dp.SyntaxHighlighter plugin instead of regular CODE and PRE tags, it should relieve the problem.
    #16 Marco on 04/27/09 at 01:48 AM [Reply]
    Great post!Thank you very much guys, it turned to be really useful!
    #17 MuthuKumar on 06/30/09 at 04:38 AM [Reply]
    hi Brendon Kozlowsk,
    its really very helpful.it neatly explained steps.i am very new to SVN
    u make setup and creating repository very very easy.thank u so much
    #18 sharath on 01/24/10 at 08:36 AM [Reply]
    Amazing... its really wonderful and detailed steps mentioned.. Thanks for the tat... Helped me a lot..
    #19 Sriniva on 04/18/10 at 12:16 AM [Reply]
    Hi,
    Thanks for providing such a great writeup.
    Srinvias
    #20 deepak on 06/29/10 at 03:23 AM [Reply]
    Good explanation...solved my major problem......thnx
    #21 Roshan on 06/29/10 at 03:23 AM [Reply]
    One of The Best Tutorial that i have ever read.
    Do posting such helpfull tutorial.so that it can help a programmer.
    Thanks,
    (3cci.in)
    #22 Roshan Shinde on 06/30/10 at 12:21 AM [Reply]
    Wow...Wow...
    A Great Article on SVN.Thanks to the authors for taking your precious time and writing such a great article which has helped me a lot to setup SVN...
    Thanks,
    (3cci.in)
    #23 Jack Repenning on 09/27/10 at 02:13 PM [Reply]
    The link here for the Windows binaries has become stale. The Subversion community volunteers who formerly maintained these binaries no longer do, as there are now professionally built and tested (and still free!) binaries available from a variety of places, such as

    http://www.open.collab.net/downloads/subversion/

    Also, these particular binaries include a fully integrated Apache server, the ViewVC repository browser, and a handy web-based admin console as well.
    #23.1 Brendon Kozlowski on 09/28/10 at 01:49 PM [Reply]
    Thank you for the update, Jack. I'll update the links in this article.
    #24 lokesh on 11/15/11 at 08:24 AM [Reply]
    Its amazing... I had a very hard time to understand this subversion tool... Hats off.. my dear.. thanks a lot.

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

BBCode format allowed