Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Install SVN Server on Ubuntu 18.04 & 16.04 LTS

    How to Install SVN Server on Ubuntu 18.04 & 16.04 LTS

    By RahulSeptember 16, 20193 Mins Read

    Subversion is an open-source version control system. It helps you keep track of a collection of files and folders. Any time you change, add or delete a file or folder that you manage with Subversion, you commit these changes to your Subversion repository, which creates a new revision in your repository reflecting these changes. You can always go back, look at and get the contents of previous revisions.

    Advertisement

    This article will help you for step by step setup of Subversion (svn) server on Ubuntu 18.04 LTS & 16.04 LTS systems.

    Step 1 – Install Apache

    First of all, you need to install the Apache webserver to access the svn server using HTTP URLs. Skip this step if you already have Apache web server on your system.

    sudo apt-get update
    sudo apt-get install apache2
    

    Step 2 – Install SVN Server

    Use the following command to install subversion packages and their dependencies. Also, install svn module for Apache libapache2-mod-svn packages on your system.

    sudo apt-get install subversion libapache2-mod-svn libapache2-svn libsvn-dev
    

    After installation, enable required Apache modules and restart Apache service.

    sudo a2enmod dav dav_svn
    sudo service apache2 restart
    

    Step 3 – Create First SVN Repository

    Use the following commands to create your first svn repository with name myrepo. Also, set the required permissions on newly created directories.

    sudo mkdir -p /var/lib/svn/
    sudo svnadmin create /var/lib/svn/myrepo
    
    sudo chown -R www-data:www-data /var/lib/svn
    sudo chmod -R 775 /var/lib/svn
    

    Step 4 – Create Users for Subversion

    Now create first svn user in /etc/apache2/dav_svn.passwd file. These users will use for authentication of svn repositories for checkout, commit processes.

    sudo touch /etc/apache2/dav_svn.passwd
    sudo htpasswd -m /etc/apache2/dav_svn.passwd admin
    

    To create additional users, use following commands.

    sudo htpasswd -m /etc/apache2/dav_svn.passwd user1
    sudo htpasswd -m /etc/apache2/dav_svn.passwd user2
    

    Step 5 – Configure Apache with Subversion

    Subversion Apache module package creates an configuration file /etc/apache2/mods-enabled/dav_svn.conf. You just need to make necessary changes to it.

    sudo vi /etc/apache2/mods-enabled/dav_svn.conf
    
    Alias /svn /var/lib/svn
    <Location /svn>
    
       DAV svn
       SVNParentPath /var/lib/svn
    
       AuthType Basic
       AuthName "Subversion Repository"
       AuthUserFile /etc/apache2/dav_svn.passwd
       Require valid-user
         
    </Location>
    

    Save the file and restart the Apache service to apply the new configuration.

    sudo service apache2 restart
    

    Step 6 – Access Repository in Browser

    Use HTTP URLs to access your repository in the browser. It will prompt for authentication. Use login credentials created in Step 5. Change example.com with your system hostname, domain name or IP address.

     http://example.com/svn/myrepo/
    

    Install Svn Server 1

    Install Svn Server 2

    Thank You for using this article. Read our next article How to Backup and Restore SVN Repository in Linux.

    subversion svn svn server
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Understanding 2>&1 in Bash: A Beginner’s Guide

    How to Choose the Best Shebang (#!) for Your Shell Scripts

    Modulus Operator (%) in Bash

    Using Modulus Operator (%) in Bash

    View 46 Comments

    46 Comments

    1. TIAGO ASSIS BRASIL on July 12, 2021 2:11 pm

      Hi,
      I need to create two folders with a subfolder each to have the following access
      http://IP ADRESS/folder1/subfolder1
      http://IPADRESS/folder2/subfolder2

      my setup is compiled this way, and i can’t recompile

      How should I proceed?

      Reply
    2. Ravi Pandey on March 18, 2021 12:49 pm

      how to checkout sir…..

      Reply
    3. Mon Rob on November 17, 2020 10:52 am

      you need to sudo apt-get install libapache-2-mod-svn

      Reply
    4. Bairavan on October 7, 2020 6:28 am

      If you want to delete a created user, use command: sudo htpasswd -D /etc/apache2/dav_svn.passwd created_user_name

      Reply
    5. Mahmoud Reza on October 6, 2020 7:55 pm

      Many thanks and I did exactly the way you did and it worked fine. I could connect to repository, but could not create folder to synch my projects. It was giving me this error: Repository permanently moved to ….

      So I found another piece somewhere else and changed the part for

      sudo vi /etc/apache2/mods-enabled/dav_svn.conf

      to this:

      ServerName Azarbod

      DAV svn
      SVNParentPath /var/lib/svn

      AuthType Basic
      AuthName “Subversion Repository”
      AuthUserFile /etc/apache2/dav_svn.passwd
      Require valid-user

      It now works.

      Reply
    6. Sawan on July 17, 2020 7:09 am

      Hi, i am facing some issue & i want to know how to commit code from my End-user, Error as below
      This XML file does not appear to have any style information associated with it. The document tree is shown below.

      Reply
    7. vennela on March 6, 2020 5:02 am

      I’m getting this error while trying to restart apache
      Job for apache2.service failed because the control process exited with error code.
      See “systemctl status apache2.service” and “journalctl -xe” for details.

      Can you please help?

      Reply
    8. Sake on February 28, 2020 12:11 pm

      Amazing was looking for svn setup , hard to find tuts on svn

      Reply
    9. Cesar on November 7, 2019 2:17 pm

      It’s true that i can’t locate my repository in external device like NAS or CLOUD?, I was reading that i could have problems… thanks!

      Reply
    10. Rita on September 26, 2019 11:23 am

      Hi
      I am tring to install SVN on Ubuntu 18.04.
      During restart I am getting this

      sudo service apache2 restart
      Job for apache2.service failed because the control process exited with error code.
      See “systemctl status apache2.service” and “journalctl -xe” for details.

      Please help.

      Reply
      • Rahul on September 26, 2019 11:54 am

        What is the output of ‘systemctl status apache2.service’?

        Reply
        • nix86 on December 17, 2019 11:41 am

          I’ve had the same problem as Rita. And here’s what I got when I ran systemctl status apache2.service:

          apache2.service – The Apache HTTP Server
          Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
          Drop-In: /lib/systemd/system/apache2.service.d
          └─apache2-systemd.conf
          Active: failed (Result: exit-code) since Tue 2019-12-17 11:19:54 UTC; 8min ago
          Process: 7570 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

          Reply
    11. Joel on September 14, 2019 8:02 pm

      how does one edit the conf file in step 5?

      Reply
      • Rahul on September 16, 2019 7:36 am

        Hi Joel, Are you facing any issue with the configuration file edition?

        Reply
    12. dario on July 8, 2019 8:05 pm

      It does not work and I don’t understand why, I followed instruction carefully 2 times. Everything seems smooth but when i try to log in it continue to ask the login, and goes nowhere. I also restarted apache2 several times and updated passwords but…nothing to do. How can I understand my errors?

      Reply
      • Rahul on July 9, 2019 9:01 am

        Hi Dario,

        I have again tested the tutorial and it works fine for me. What issue are you getting?

        Reply
        • Dario on July 9, 2019 9:29 am

          Thanks Rahul, I’ve followed the procedure and everthing is just fine, then when i go to http://myip/vpn/repo (with the right address) I get the autentication required, but when I login continue to ask me the name and password and goes nowhere

          Reply
          • Scott on August 21, 2019 10:20 pm

            You may have had the same issue I did – I added several users when doing the add users step above – but I kept using the same initial command that had the “-cm” in it. the “c” creates the file, wiping any entries from before so you only end up with the last user you added. If you also added multiple users, try logging in with the last user you added and see if that works. Solution is to make sure you are using just the “htpasswd -m” option for all users after the first user (and not “htpasswd -cm”). Hope this helps someone!

            Reply
    13. Sonal on April 24, 2019 9:58 am

      I have created user with : sudo htpasswd -m /etc/apache2/dav_svn.passwd user1

      So how user1 can change the password to access the repo.

      Reply
      • Rahul on April 24, 2019 11:40 am

        You can simply run the same command to update the password.

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

        FYI: Do not use -c while updating passsword. This will recreate the existing dav_svn.passwd file.

        Reply
    14. Koen Segers on February 27, 2019 11:17 am

      I can confirm it is required to disable the Alias rule
      in dav_svn.conf
      #Alias /svn /var/lib/svn

      Otherwise you’ll get:
      “Repository moved permanently svn” error message.

      Reply
    15. Chin on November 13, 2018 8:25 am

      I have to remark the line of
      “Alias /svn /var/lib/svn”
      in dav_svn.conf, for my import action to work, without
      “Repository moved permanently svn” error message.

      FYI.

      Reply
    16. chams on October 25, 2018 11:51 am

      sudo a2enmod dav_svn
      ERROR: Module dav_svn does not exist!

      Help please

      Reply
    17. Nishant on July 23, 2018 7:43 am

      Hi,
      I follow each and every step in tutorial and tried to access SVN repository with

      “http://localhost/svn/myrepo”

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

      Reply
      • jnuc093 on September 20, 2018 8:12 am

        me too

        Reply
        • Rahul K. on September 22, 2018 7:53 am

          Are you using the same directory structure and configuration as in article.

          Also, Please confirm, what is showing on http://localhost/svn/ url?

          Reply
          • Felipe on January 1, 2019 11:46 pm

            You need to restart apache server

            Reply
      • LazyCodeMonkey on July 10, 2019 11:41 am

        Hi there, when I followed the guide I too had this problem. The article above is correct, but the default SVN config file has some extra lines that can get you into trouble and cause this problem – as I found myself.

        Turns out I used the wrong directive in the config file. If you are setting up multiple repos (as per this article) and use “SVNPath” you get these errors messages. That’s because you have gone and created “myrepo1”, “myrepo2”, “myrepo3” … etc and the “SVNPath” directive is expecting a single repo at /var/lib/svn.

        You need to use the “SVNParentPath” directive to tell SVN that there are multiple repos sitting under this path.

        So my config file now uses this (as per the article above) and it works:

        SVNParentPath /var/lib/svn

        Reply
    18. Ashanta on February 26, 2018 6:18 am

      Rahul,

      Can you please help me, Why we use SVN? and what the steps to configure SVN in redhat.

      Regards
      Ashanta

      Reply
    19. Vishal Rana on October 9, 2017 6:49 am

      what is my host name, domain name or IP address.
      how do i know that

      Reply
      • Rahul K. on October 9, 2017 9:20 am

        You can use following commands to get the hostname of your system or ip address.

        $ hostname
        $ ifconfig

        Reply
    20. jim on August 1, 2017 1:01 am

      good – thanks.

      Reply
    21. jiayanchao on July 10, 2017 6:30 am

      Alias /svn /var/lib/svn is redundant and it will cause an error “svn: E195019: Redirect cycle detected for URL ‘http://172.18.19.182/svn/heliteqRepo'”

      Reply
      • Mash on July 24, 2017 5:42 am

        Thanks, it helps

        Reply
    22. Sagar on June 16, 2017 2:47 pm

      How to Store my commie file

      Reply
    23. Bruno Romeiro on May 17, 2017 3:46 pm

      Hi, Rahul,
      I followed your tutorial to the end inside a VirtualBox, but when I try to execute the ‘svn list’ command it returns the error ‘E195019: Redirect cycle detected for url’.
      Do you know how to fix this?

      Reply
      • Sean on May 18, 2017 3:50 pm

        Hi,

        I removed the Alias /svn /var/lib/svn line from the /etc/apache2/mods-enabled/dav_svn.conf file in Step 3. and the problem was solved.

        Reply
    24. Pamblam on May 15, 2017 4:43 am

      Regarding Step 3…

      I found that in order to see the directory contents in the browser I had to add the following line to the config file in addition to those shown:

      SVNListParentPath On

      See: http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html#svn.serverconfig.httpd.extra.browsing.reposlisting

      I also found that these changes do not take effect until you restart Apache again by running:

      sudo service apache2 restart

      Otherwise, this was very helpful. I used these instructions to get started on a browser based Subversion client (https://github.com/Pamblam/iLoveLAMP). Thanks for the article.

      Reply
    25. Wayan Saryada on April 28, 2017 6:22 am

      The following line:

      “`
      AuthUserFile Require valid-user
      “`

      Must only be:

      “`
      Require valid-user
      “`

      Reply
      • Rahul K. on April 29, 2017 3:13 am

        Thanks, Wayan
        The article has been updated.

        Reply
    26. santosh on April 4, 2017 9:53 am

      Hi Rahul,

      I tried same config in ubuntu 16.10 and got the following errors.

      [email protected]:/$ sudo a2enmod dav_svn
      ERROR: Module dav_svn does not exist!

      Reply
      • ChieLan Lee on September 1, 2018 2:26 am

        I’d fixed this error.
        Please see this solution
        https://kcode.de/wordpress/1734-fixing-libapache2-svn-error-module-dav_svn-does-not-exist
        ————
        Well, just create the folders

        /etc/apache2/mods-available/dav_svn.conf
        /etc/apache2/mods-available/dav_svn.load
        ————

        Reply
    27. Recharde on March 8, 2017 8:26 am

      Hello, now i wish to add an extra repository like “Music” and its view in browser repository, what is the process ?

      Reply
      • Rahul K. on March 9, 2017 8:27 am

        Use below command
        $ sudo svnadmin create /var/lib/svn/Music

        Now access in browser like: http://localhost/svn/Music

        Reply
    28. Oscar Gavilan on February 27, 2017 1:57 pm

      I was getting an authentication error until I add “Require valid-user”, for example:

      Alias /svn /var/lib/svn

      DAV svn
      SVNParentPath /var/lib/svn
      SVNListParentPath On

      AuthType Basic
      AuthName “Subversion”
      AuthUserFile /etc/apache2/dav_svn.passwd
      Require valid-user

      Reply
      • Rahul K. on March 9, 2017 8:32 am

        Thanks Oscar,

        The tutorial has been updated.

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.