SVN Server on Ubuntu 12.04 LTS with Web Access

To install SVN server, run this command at the command prompt:

sudo apt-get install subversion libapache2-svn apache2

Make the directory where you want to keep the svn repositories and edit the dav_svn.conf file:

sudo mkdir /svn
sudo nano /etc/apache2/mods-enabled/dav_svn.conf

Delete all the data and make it simple like this 🙂

<Location /svn>
DAV svn
SVNParentPath /svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>

To create a svn user , use the following command:

sudo htpasswd -cm /etc/apache2/dav_svn.passwd arbab

We only need to use the –c option for the FIRST TIME, when you create a user, after that you will only use the -m option.

Move to the folder, where you want to keep your repositories and create your first repository:

cd /svn
sudo svnadmin create test_repo

Make sure you set the permissions of the /svn directory to apache with the following command:

sudo chown -R www-data:www-data /svn

Restart the apache2 service:

sudo /etc/init.d/apache2 restart

On Windows machine, Right-Click  and select the SVN Checkout, inside the directory where we want to store the working copy (In my case, it’s on desktop).

Enter the repository’s URL and click OK, it will be prompted for a login and password.  Enter the login information and click OK.

We shall receive a screen that looks like this:

Create some test file inside the checkout repository, Right-Click and Select the SVN Commit:

Enter the comments that describe the purpose of this commit:

It will be prompted for a login and password.  Enter the login information and click OK.

The result of the commit will appear in a dialog window.

Congrats! now we have a working SVN server on Ubuntu 12.04 🙂

Hope this will help you!

Please Remember me in your prayers!

32 responses to “SVN Server on Ubuntu 12.04 LTS with Web Access

  1. Oscar Alvarez May 19, 2012 at 8:27 pm

    Hi, i have a problem, when I tried to open http://localhost/svn on my pc it shows an error: “Forbidden

    You don’t have permission to access /svn on this server.
    Apache/2.2.22 (Ubuntu) Server at localhost Port 80”

    Thanks for your help.

  2. Pingback: Access Control in SVN with authz_svn « Lazy Geek -:)

  3. Mr. F August 2, 2012 at 7:41 am

    This works out of the box! Thank you so much! 😀

  4. Tapan Upadhyay August 21, 2012 at 4:02 am

    greate tutorial ….many thanks my friend…..

  5. sparkman September 4, 2012 at 7:01 am

    This worked great for me until I tried to access the remote SVN repo on my Mac. I keep getting this error:

    Description : An error occurred while contacting the repository at “10.0.1.100”.
    Suggestion : The server may be unreachable or the URL may be incorrect.

    Technical Information
    =====================

    Error : V4CommunicationError
    Exception : ZSVNCommunicationException

    Causal Information
    ==================

    Description : Unable to connect to a repository at URL ‘http://myusername@10.0.1.100/svn/test_repo’
    Status : 175002

    Description : Server sent unexpected return value (303 See Other) in response to OPTIONS request for ‘http://myusername@10.0.1.100/svn/test_repo’
    Status : 175002

    • sparkman September 4, 2012 at 7:49 am

      Forgot to mention this is in Cornerstone on the Mac. I get a similar error in Eclipse/STS but I can browse the repo in Chrome and it works fine in Tortoise on Windows.

  6. mohan September 21, 2012 at 7:36 pm

    Checkout from http://197.20.1.77/svn/test_repo, revision HEAD, Fully recursive, Externals included
    Repository moved permanently to ‘http://197.20.1.77/svn/test_repo/’; please relocate

    Unable to connect with my Ubuntu server.

  7. mohan September 22, 2012 at 9:46 am

    I Configure above maintained step only, I change only path /srv/svn.

  8. Pablo September 25, 2012 at 6:56 am

    Hello. This tutorial is wonderful and it works really grat in my network, but whenever I try to access it from the internet, it doesn’t allow me to download the repository. I have done port forwarding and I’m using a dynamic IP. Could you help me get this working from anywhere?

  9. rbgeek September 25, 2012 at 10:18 am

    Pablo, can you tell me that which port you are forwarding ? and also tell me the url that you are using to access your repository from the internet?

    You can use dyndns.org if you want to use it with dynamic ip.

    • Pablo September 26, 2012 at 4:01 am

      Sorry for taking such a long time to reply, it’s that work’s been chaotic lately. I’m forwarding port 3690. The url I’m using is the current IP my machine’s using /svn/test. I tested it with a friend.

      Is it necessary to use dyndns.org to make it work with a dynamic IP? I’ll try it. If with that information you know what I’m doing wrong please telle me, and in case I find out what I’m doing wrong I’ll tell you, so you can help others with the same problem I’m having.

      • Arbab September 26, 2012 at 11:11 pm

        pablo, why you are forwarding port 3690? you need to forward port 80! first access the svn repostory from inside the network and then forward the port 80 in your firewall towards your svn server. I hope that will solve your problem.

        ________________________________

      • Pablo September 28, 2012 at 3:46 pm

        Hello. I can access it from my network with my internal IP. I can access the web page. Now I’m forwarding port 80 and type my external IP and it doesn’t work. Any ideas?

  10. keithwilson612 October 16, 2012 at 6:50 pm

    I can’t get this to display the svn view for me in the browser:

    Not Found

    The requested URL /svn/test_repo was not found on this server.

    Apache/2.2.14 (Ubuntu) Server at nas01.local Port 80

    Apache was already installed – could that be the issue? If so how do I get round this?

  11. Pingback: SVN Server on Ubuntu 12.04 LTS with Web Access | Setiyacellular

  12. Pingback: SVN unter Ubuntu einrichten – Tjuringa

  13. Irfan February 5, 2013 at 9:40 pm

    Hello, I did all steps, but when i try to checkout by entering username and password, it just does nothing. It asks again and again but does nothing.

  14. ryanc February 13, 2013 at 9:46 pm

    Thanks for the great info. I have already setup the repository. I was trying to access from another computer. I have set the URL as http://%5Bipaddr%5D/svn/test_repo.
    but I am having trouble moving past the authentication. how would i check if the users have been setup correctly?

  15. alok May 27, 2014 at 7:52 am

    Great tutorial but i cannot see any data after commit my data . If i access from web via URL, i see the data is there. 😦

  16. Pingback: Web Server In Ubuntu Danish's Story | Danish's Story

  17. faiz fadlyFaiz September 15, 2016 at 3:19 pm

    how to make 2 user configuration

    • rbgeek September 19, 2016 at 9:36 pm

      sudo htpasswd -m /etc/apache2/dav_svn.passwd second_username

      Note that we don’t need to add the character “c” in it otherwise it will delete your previous file and create the new one, so use the same command that you have used to create the first user but remove the “c” flag from it. Hope that hope you.

Leave a reply to alok Cancel reply