How To Install Apache SVN on Linux Mint 19 / Linux Mint 18

Subversion, widely known as SVN, is open source version control system used for storing the historical changes of source file and documents and manages it over a period of time.

This post helps you to setup SVN on Linux Mint 19 / Linux Mint 18.

Install WebServer

Update the repository index.

sudo apt-get update

Here we will install Apache server as a web server for the SVN repository.

sudo apt-get install -y apache2 apache2-utils

Verify the Apache web server by visiting

http://your.ip.add.ress
Install Apache SVN on Linux Mint 19 – Apache’s Test Page

Install Apache Subversion

Once the Apache is installed, issue the following command to install subversion.

sudo apt-get install -y subversion subversion-tools libapache2-mod-svn

Configure Apache Subversion

Once the installation is done, you can start to create repositories as per the requirements. In my case, I am creating /svn as the base and will create the repository in it.

sudo mkdir /svn

Create the repository called “testrepo”.

sudo svnadmin create /svn/testrepo

Change the permission of the repository in such a way that Apache can read and write.

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

Configure virtual host in Apache.

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

Place the following content.

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

Create a password file for the user. Replace raj with your username.

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

Restart the apache server.

sudo service apache2 restart

Access the SVN using the browser, URL will be

http://your.ip.add.ress/svn/testrepo

You will be asked to enter the username and password.

Install Apache SVN on Linux Mint 19 – Apache SVN Authentication

Upon successful login, contents will be listed as below.

Install Apache SVN on Linux Mint 19 – Apache SVN Revision 0

Check out the files contained within the repository to the testing directory, create a directory called svncheckout.

mkdir svncheckout
svn checkout http://192.168.1.10/svn/testrepo --username raj svncheckout/

The output will be like below.

Install Apache SVN on Linux Mint 19 – SVN Checkout

You can create some test files in the checkout directory.

cd svncheckout/
touch checkout1.txt
touch checkout2.txt

Add the files for committing.

svn add checkout1.txt checkout2.txt

Output:

A         checkout1.txt
A         checkout2.txt

Commit the added files.

You can mention the commit message with -m option.
svn commit -m 'First Revision'

Output:

Adding         checkout1.txt
Adding         checkout2.txt
Transmitting file data ..done
Committing transaction...
Committed revision 1.

Committed files can be viewed in the browser.

Install Apache SVN on Linux Mint 19 – Apache SVN Revision 1

That All. You can also use SVN clients such as TortoiseSVN for windows and RapidSVN for Linux.

apachelinuxmint 18linuxmint 19subversionsvn
Comments (4)
Add Comment
  • Harmeet Singh

    The example is really good, but i face one problem. When i add the SVN seurity configuration on svn.conf file and restart the apache server. i get following error:
    * Starting web server apache2 *
    * The apache2 configtest failed.
    Output of config test was:
    AH00526: Syntax error on line 5 of /etc/apache2/conf-enabled/svn.conf:
    AuthName takes one argument, the authentication realm (e.g. “Members Only”)
    Action ‘configtest’ failed.
    The Apache error log may have more information.

  • Scott Doherty

    Harmeet and anyone else with the same problem. All you need to do is remove the quotes from around “Authorization Realm” (they are not normal ascii quotes. And then type ” around it. That fixed it for me.

    • Raj

      Thanks Scott, It was due to web page rendering. Have updated the syntax

  • Sri-Ka

    Helped a lot. Thank you!!!