Setting Up Apache Subversion on Debian/Ubuntu

Installing Apache Subversion

  1. Log into the Linux device
  2. Run the following commands in a terminal:
    # update software repositories
    sudo apt update
    # install apache
    sudo apt install apache2
    # install subversion and apache modules
    sudo apt install subversion libapache2-mod-svn
    # create a new subversion group
    sudo groupadd subversion
    # add user(s) to the new group
    sudo addgroup i12bretro subversion
    # create the repository directory and set permissions
    sudo mkdir /var/lib/svn
    sudo chown -R www-data:subversion /var/lib/svn/
    sudo chmod -R 770 /var/lib/svn/
    # create a test repository
    sudo svnadmin create /var/lib/svn/Youtube_TEST
    # enable apache modules
    sudo a2enmod dav dav_svn
    # create a new svn.conf file to configure the site
    sudo nano /etc/apache2/sites-available/svn.conf
  3. Paste the following configuration into svn.conf

    Alias /svn /var/lib/svn

    <Location /svn>
       DAV svn
       SVNListParentPath On
       SVNParentPath /var/lib/svn
       Require all granted
       AllowOverride None
    </Location>

  4. Press CTRL+O, Enter, CTRL+X to write the changes to svn.conf
  5. Continue with the following commands to enable the site and restart Apache:
    # enable the svn site
    sudo a2ensite svn
    # restart apache2 service for the changes to take effect
    sudo systemctl restart apache2
  6. Open a web browser and navigate to http://DNSorIP/svn/Youtube_TEST
  7. A bare bones directory listing of the "Youtube_TEST - Revision 0: /" should be displayed