Skip to main content

How to setup SVN server on ubuntu 14.04

SVN (Subversion) is an opensource version control system. it is used to store previous changes of your project files like documentation, coding etc. also you can track and identify who made the particular changes in the project files . Here in this article we can see how to setup SVN server on ubuntu 14.04 .

Setup SVN server on ubuntu 14.04

Let’s start the installation .
Step 1 » Issue the below command to update the repositories.
sudo apt-get update
Step 2 » After updating repositories , Issue the below command to install SVN and apache webserver (To access SVN through http ) .
sudo apt-get install subversion apache2 libapache2-svn apache2-utils
Step 3 » Now create a directory and create a new repository in that directory ( Here i’m using testrepo as repository name ).
sudo mkdir -p /svn/repos/
sudo svnadmin create /svn/repos/testrepo

Step 4 » Now change ownership for the repository.
sudo chown -R www-data:www-data /svn/repos/testrepo
Step 5 » Create a file testrepo.conf in /etc/apache2/sites-available/ and add the below lines for creating apache virtual host.

SVNParentPath /svn/repos/ : Parent Directory without repository name.
AuthUserFile /etc/svnpasswd : File need to be created ( Step 8) for user details.

Step 6 » Issue the below command to enable the Site ( testrepo in the below command should match the file name created in the previous step )
sudo a2ensite testrepo
Step 7 » Now restart or reload apache service.
sudo service apache2 reload
Step 8 » Issue the command to create user for accessing repository and add the user details to /etc/svnpasswd file.
Use this command to create first user.
sudo htpasswd -cm /etc/svnpasswd user1
Use the same command without c option to create additional users.
sudo htpasswd -m /etc/svnpasswd user2
Step 9 » Now you can access http://yourip/svn/testrepo in your browser ( Eg http://10.0.1.15/svn/testrepo ) and you can see the page like below after successful authentication.
Setup svn server ubuntu 14.04
That’t it , your server is ready.
You could use svn clients such as Tortoisesvn on windows and Rapidsvn on ubuntu for commiting and updating repository.
good luck

  • Devanshi

    what does this error mean?

    sudo service apache2 reload

    * Reloading web server apache2 *

    * The apache2 configtest failed. Not doing anything.

    Output of config test was:

    AH00526: Syntax error on line 34 of /etc/apache2/sites-enabled/anusha.conf:

    ServerAlias only used in

    Action ‘configtest’ failed.

    The Apache error log may have more information.

    • George

      Hi Devanshi
      Can you paste anusha.conf content here ?
      ServerAlias should be inside like below.

      ServerName http://www.google.com

      ServerAlias google.com

  • Devanshi

    what does this error mean?

    sudo service apache2 reload

    * Reloading web server apache2 *

    * The apache2 configtest failed. Not doing anything.

    Output of config test was:

    AH00526: Syntax error on line 34 of /etc/apache2/sites-enabled/anusha.conf:

    ServerAlias only used in

    Action ‘configtest’ failed.

    The Apache error log may have more information.

    • George

      Hi Devanshi
      Can you paste anusha.conf content here ?
      ServerAlias should be inside like below.

      ServerName http://www.google.com

      ServerAlias google.com

      • narayana rao

        hii bigginar in ubuntu and svn ..i have to done create repository but how to insert project in svn please help me….

    • dinesh

      Hi Devanshi,

      I am also getting same error.
      have resolve the error?

      Dinesh

  • obaid

    Hi
    created testrepo.conf in /etc/apache2/sites-available/
    now i dun wan it any more and as i deleted testrepo.conf
    and restart apache it gives error at
    apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/testrepo.conf: No such file or directory

    so just to restart apache created enpty testrepo.conf

    but looking for proper solution if dun needs testrepo and testrepo.conf any more so wat to do

  • obaid

    Hi
    created testrepo.conf in /etc/apache2/sites-available/
    now i dun wan it any more and as i deleted testrepo.conf
    and restart apache it gives error at
    apache2: Syntax error on line 219 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/testrepo.conf: No such file or directory

    so just to restart apache created enpty testrepo.conf

    but looking for proper solution if dun needs testrepo and testrepo.conf any more so wat to do

    • Việt Quang Trịnh

      I got the same issue and here’s the way to solve, just run following command to disable repository on apache
      sudo a2dissite testrepo.conf

  • alabastida

    Loved this way of creating an svn server, handled by apache instead of standalone, pretty interesting, i liked this way, thanks

  • alabastida

    Loved this way of creating an svn server, handled by apache instead of standalone, pretty interesting, i liked this way, thanks

  • Jean Hsu

    make sure you put
    sudo a2ensite testrepo.conf
    (the .conf) might be important 🙂

    Thanks for the article!

    • Jean Hsu

      just adding some details: I had problem with the virtual host so I added

      … your virtual host configuration …

  • Jean Hsu

    * sudo a2ensite testrepo.conf
    (the .conf) might be important 🙂
    *sudo service apache2 restart might be needed instead of reload…

    Thanks for the article!

    P.S. delete the article below … virtualhost was not needed..

    • Guest

      just adding some details: I had problem with the virtual host so I added

      … your virtual host configuration …

  • Hamid Pourgholi

    Hello,
    it looks like that its quite important that the repository’s parent folder (/svn/ in this case) is located on the top of the linux filesystem hirarchy ( / ).
    After installing the server following the instructions in this article, I had a problem with the permissions of the parent folders of the “repos” folder and the problem was that if the svn folder is not on top of the filesystem (/svn/) then all of its parent folders would also have to be owned by www-data.

    Maybe this helps if someone finds the same solution in google like me for that error and then is not sure if its right or right.
    For me t worked.
    I created the svn folder in /svn/ in my linux machine and it worked.

  • Hamid Pourgholi

    Hello,
    it looks like that its quite important that the repository’s parent folder (/svn/ in this case) is located on the top of the linux filesystem hirarchy ( / ).
    After installing the server following the instructions in this article, I had a problem with the permissions of the parent folders of the “repos” folder and the problem was that if the svn folder is not on top of the filesystem (/svn/) then all of its parent folders would also have to be owned by www-data.

    Maybe this helps if someone finds the same solution in google like me for that error and then is not sure if its right or right.
    For me t worked.
    I created the svn folder in /svn/ in my linux machine and it worked.

    • New Java

      confirmed.

  • I have created the svn server as described above, but I want to know how can I add this repository ineclipse for my projects.

  • Thanks! Loved your tutorial

  • william richard Cordero

    Great article! Just wanted to ask: I have followed this exactly and seems to have everything configured correctly except for I get the following error below when trying to access via browser, I can login, but it say the message below:

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    Could not open the requested SVN filesystem

    Any help given would be greatly appreciated…might be simple fix..but will be much appreciated!

    • Benedict Suarez

      Same problem. How do you solve it?

  • mAYUR

    Great Article (y)

  • Jacob Bolea Moreno

    Thank you! It was very usefull!!! 10/10

  • gguys1

    “SVNParentPath” did not work for me, it had to be “SVNPath”

  • Chicken Little

    like a charm. thanks

  • pawel

    Hello guys, i’ve just configured SVN using this tutorial. I can checkout repo but i can not commit any changes. Clients using Tortoise SVN on Windows, SVN server is on Ubuntu 14.04.

    Error during commit is:
    “Can’t open file ‘/svn/repos/testrepo/db/txn-current-lock’: Permission denied”

    Any advices what can I do?

    • Xawkay

      Check permissions and owning by group and users

  • Praveen Kumar

    hey william do get your solution for problem what u were facing?? please tell if you solve it.. i got the same error..

  • Rafique Mohammed

    Great!! did it for the first time!! thanks!

  • john

    I am getting this error all the time . . . .

    root@svn-new:/etc/apache2/sites-available# service apache2 reload
    * Reloading web server apache2
    *
    * The apache2 configtest failed. Not doing anything.
    Output of config test was:
    AH00526: Syntax error on line 2 of /etc/apache2/sites-enabled/testrepo.conf:
    Invalid command ‘xc2xa0xc2xa0DAV’, perhaps misspelled or defined by a module not included in the server confi
    guration
    Action ‘configtest’ failed.
    The Apache error log may have more information.

    • Shubham Hatwar

      just run the following command ,the problem is that the module that need by the svn in not loded in apache so use the following command and check it
      #apt-get install subversion apache2 libapache2-svn apache2-utils