00101010

My blog on life the universe and everything…

How to create your own home SVN repository with Xampp/Apache

I am not going to talk about the benefits of version control in your projects, those you can search and read about elsewhere. In this HowTo I am simply going to describe the steps necessary to setup your own svn repository accessible from anywhere in the world using the apache server. This will assume you are using apache installed with xampp the all-in-one installer of your WAMP (Windows Apache,MySQL,PHP) setup.

  • After installing Xampp, point your browser at http://localhost to make sure that your server is running.
  • Copy the files mod_authz_svn.so and mod_dav_svn.so found under your subversion bin directory (e.g. C:/Program Files/Subversion/bin/) to the C:\xampp\apache\modules directory,
  • Now edit your Apache httpd.conf found under C:\xampp\apache\conf (keep a backup for peace of mind) and enable the lines

LoadModule dav_svn_module modules/mod_dav_svn.so

LoadModule authz_svn_module modules/mod_authz_svn.so

If you can’t see these lines copy-paste them from here. Then go at the end of the file and add the following lines:

# Configure Subversion repository
<Location /svn>
DAV svn
SVNPath “C:\svn”
AuthType Basic
AuthName “Subversion repository”
AuthUserFile “c:\svn_conf\passwd”
Require valid-user
</Location>

  • Save and close the httpd.conf file, then restart Apache.

NOTE: In case apache does not start this means that there is something wrong in the httpd.conf file. Go to the xampp/apache/bin folder in your drive and run apache from the command line to see exactly at which line the problem is. For examle you might have to remove the quotes on the above lines to get it to work. So you need to experiment until apache gets up and running correctly.

Also note that If you have Skype running you might not be able to start any of the Xampp service due to some strange conflict. Close skype, start the xampp services you want and then start skype again. This should solve it.

  • Now create two folders in your C:\ drive, one called svn and the other called svn_conf.
  • In order to password protect your repository fire up a command prompt and browse into the apache/bin folder C:\xampp\apache\bin and then type htpasswd -c C:\svn_conf\passwd yourname
  • Now it’s time to create your first repository. Go in the C:\svn folder just created and right-click in it. From the drop-down menu choose ToirtoiseSVN ->Create repository here. If all goes fine ToirtoiseSVN will inform you that the repository was created sucessfuly.
  • Finally in order to import the directory where you keep your source code into your repository right-click on the source code directory and choose ToirtoiseSVN->Import. In the window that shows up type the path to your svn repository, that is file:///C:/svn.

Test your setup by pointing your browser to http://localhost/svn and entering the username/password combination that you have defined.

inspiration & credits:lifehacker

30 responses to “How to create your own home SVN repository with Xampp/Apache

  1. TEHEK December 25, 2008 at 5:25 pm

    Skype uses port 80 by default for some incoming connections.

    Turn it off in preferences.

    Tools – Options – Connection – Use 80 and 443 ports ….

  2. TEHEK December 25, 2008 at 5:38 pm

    P.S.: Reboot your comp after copying *.so files.

    new *.so files will probably be different from those that already there in apache/modules/. Consider making backups.

  3. Muhammad Bashir Al-Noimi March 9, 2009 at 10:56 am

    Could you please tell me how I can specify the preveilgies (read/write/no access) of repository’s folders?

    As you mentioned above you talked about preveilgies of whole repository but you didn’t talk about its folders.

    Note:
    I tried to use VisualSVN it’s free but not open source and it’s too easy specially when you want to manage groups and users. For that i’m looking for open source distro give same easy management for SVN users and groups. Do you know open source product just like VisualSVN

  4. Amit March 29, 2009 at 12:24 pm

    Xampp is a good software
    But I have Checked few other of PHP local servers and
    came to conclusion that WAMP Server IS the best out there.
    Easy to install, Intuitive to work with.

    Great software for all PHP developers out there.

    If you using Skype while working on developing
    Make sure to start WHAP before Skype (and not the other way around).
    That the only “bug” I have found.

    Strongly recommend to use it!

    What do you think?

  5. Ferinannnd May 25, 2009 at 5:56 am

    Как по мне – тема раскрыта четко, спасибо за пост!

  6. Chris May 28, 2009 at 5:03 pm

    Thanks for the info. I had some trouble with the lines I had to add to the httpd.conf at the end. When I copied/pasted from the web page, the double-quotes were not correct for some reason.

    I deleted the quotes and manually typed them in and they looked different. So, issue resolved by replacing the quotes manually.

    I am using Notepad++ for text editor. I haven’t experimented, but I think Notepad++ interpreted the double-quotes as something different when pasted?

  7. Bo June 11, 2009 at 9:01 am

    I have done as you described.. but get a error :
    “Could not open the requested SVN filesystem”

    Anyone who knows how this can be fixed ?

  8. Orihime August 17, 2009 at 2:25 am

    Thank you for the guide serk01!

    I also had the same problem as Chris. I am on Vista and had to delete quotes and manually enter them for Apache to start. Hope this information is helpful to someone else.

  9. Orihime August 17, 2009 at 3:50 am

    @Bo: I experienced same problem, turns out the issue is that the link in the post is pointing toward an old version of Subversion. Go here to get the latest version: http://subversion.tigris.org/

  10. mummybot December 2, 2009 at 4:25 pm

    I had a problem with the quotes as well, but on XP. Turns out that in copying and pasting from this page, the characters were being encoded incorrectly in notepad. Manually replace the “ with ” and you should be alright.

  11. Shayde January 4, 2010 at 12:37 pm

    i get this error
    apache.exe: Syntax error on line 146 of C:/xampp/apache/conf/httpd.conf: API mod
    ule structure ‘dav_svn_module’ in file C:/xampp/apache/modules/mod_dav_svn.so is
    garbled – expected signature 41503232 but saw 41503230 – perhaps this is not an
    Apache module DSO, or was compiled for a different Apache version?
    Can someone help me on that?

  12. Shayde January 4, 2010 at 12:46 pm

    Reinstalled subversion with apache v2.2
    And now this comes up

    Syntax error on line 533 of C:/xampp/apache/conf/httpd.conf:
    AuthName takes one argument, The authentication realm (e.g. “Members Only”)

    Line 533 is this
    AuthName “Subversion repository”

    Any help on this?

    • Richard Lalancette February 16, 2010 at 4:20 pm

      Replace the quotes for the right ones.

      # SVN Setup
      # Configure Subversion repository

      DAV svn
      SVNPath “C:\svn”
      AuthType Basic
      AuthName “Subversion_repository”
      AuthUserFile “c:\svn_conf\passwd”
      Require valid-user

  13. nxhoaf January 13, 2010 at 2:48 am

    can anyones writes a tutor on linux ?

  14. Richard Lalancette February 16, 2010 at 4:19 pm

    In my case, the quotes ” in the block of code for the conf file caused issues.

    Make sure you have the appropriate quotes in there.

  15. maLakai February 17, 2010 at 4:47 pm

    And if anybody gets an error like “Could not open the requested SVN filesystem” then you should change to forward quotes in the path, even on windows.
    So it became like this:

    # Configure Subversion repository

    DAV svn
    SVNPath “C:/svn”
    AuthType Basic
    AuthName “Subversion repository”
    AuthUserFile “c:/svn_conf/passwd”
    Require valid-user

  16. idrish March 9, 2010 at 6:43 am

    When i try to locate http://localhost/svn it shows a 404 page not found error. Any pointers why this is happening. I am quite sure i have followed the same steps as mentioned in the post

  17. Patrice March 30, 2010 at 8:09 pm

    Thanks a lot for your explanations.
    Worked fine (2010/03/30) with latest versions of all packages.
    As somebody already tell us, be careful to the standard double qutes!
    Best regards,
    Patrice.

  18. Pingback: links for 2010-03-31 | Michael Ong | On9 Systems

  19. Saravanan June 22, 2010 at 5:11 am

    Thanks for you tute, it worked fine for me. the double quote had the problem that it was interpreted as 2 back-tick’s, it works fine.
    Thanks and Regards,
    Saravanan

  20. Saravanan June 22, 2010 at 5:15 am

    Do you have any other tutorial on how to use the repository, ‘cos i am a newbie to SVN. If so let me know. I feel that you are good in delivering the right content to be understandable by all.

  21. serk01 June 22, 2010 at 9:42 am

    @Saravanan,
    I’m glad it worked fine for you mate. Thanks for the kind words too. I’m afraid though I don’t have any other tutorials of my own on how to use svn. You will need to do some googling on that, there are some great resources out there to help you get started. cheers!

  22. saravanan June 23, 2010 at 4:21 am

    Thanks Serk01 for your reply.I will google for further information and will let you know if it is good too.

    Cheers
    saravanan

  23. Permana Jayanta July 7, 2010 at 5:14 am

    I try install but there are error “Could not open the requested SVN filesystem”. I try what the comment suggest but there are still error

    I use :
    – XAMPP 1.7.2
    – TortoiseSVN-1.6.7.18415-win32-svn-1.6.9.msi

  24. jlinsky July 21, 2010 at 7:27 pm

    Thank you so much for this easy to follow guide. After mucking around trying to follow directions for an apache install, it was nice to have a simple explanation for XAMPP. 🙂
    -Jack

  25. Jack Repenning September 27, 2010 at 9:35 pm

    The download links for the Subversion installer in this article are stale. The Subversion community volunteers who formerly provided installers there no longer do so, because professionally built and tested (and still free!) binaries are available from sites such as

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

    Also, the latest server binaries include a great one-click installer, that sets up Subversion, Apache, python bindings, ViewVC, and a web-based admin console, making server installations much easier.

  26. Jack Repenning September 27, 2010 at 9:37 pm

    The old location of this site, serk01.wordpress.com, also still has these stale pointers, and is still a popular reference point for downloaders. It would help folks if that site could be fixed up as well (comments are closed, so I couldn’t provide this hint there).

  27. serk01 October 22, 2010 at 2:52 pm

    @Jack Repenning,
    thanks for noting this, I’ve now fixed the link on both sites

  28. Pingback: Setup a Subversion repository using xampp (Apache) « JN IT Blog

%d bloggers like this: