Install Apache SVN on Linux Mint 17

Apache Subversion

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 LinuxMint 17.

Installing WebServer:

Update the repository.

sudo apt-get update

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

sudo apt-get install apache2 apache2-utils

Start the Apache and verify it by visiting http://your.ip.address.

sudo /etc/init.d/apache2 start

Installing Subversion:

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

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

Configuring 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/conf-enabled/svn.conf

Place the following content.

<location /svn>
DAV svn
SVNParentPath /svn
</location>

Restart the apache server.

sudo /etc/init.d/apache2 restart

Access the SVN using the browser, url will be http://your-ip-address/svn/testrepo. It wont ask you any password to view.

Linux Mint 17 - SVN Repository
Linux Mint 17 – SVN Repository

Securing SVN: (Optional)

The above setting would allow the anonymous users to view and committing the files. To stop the anonymous access, you have to edit the apache configuration which was created just two steps before.

sudo nano /etc/apache2/conf-enabled/svn.conf

Place the following content.

<location /svn>
DAV svn
SVNParentPath /svn/
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/subversion/svn.users
Require valid-user
</location>

Created the password file for the user.

sudo htpasswd -cm /etc/subversion/svn.users raj

Restart the apache server.

sudo /etc/init.d/apache2 restart

Testing Subversion:

You can visit the url http://your-ip-address/svn/testrepo to check out the content, you will be asked to enter the user name and password (If you have setup the Secure SVN.

Linux Mint 17 - Secured SVN Repository
Linux Mint 17 – Secured SVN Repository

Upon successful login; content will be listed like below.

Linux Mint 17 - SVN Repository
Linux Mint 17 – SVN Repository

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

mkdir svncheckout
svn checkout http://192.168.2.124/svn/testrepo svncheckout/

Output will be like below.

Linux Mint 17 - SVN Checkout
Linux Mint 17 – 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
A         checkout1.txt
A         checkout2.txt

Commit the added files, you can mention the commit message with -m option.

svn commit -m 'First Revision'
Adding         checkout1.txt
Adding         checkout2.txt
Transmitting file data ..
Committed revision 1.

Committed files can be viewed in the browser.

Linux Mint 17 - SVN Checkout Files
Linux Mint 17 – SVN Checkout Files

That All!.. You can use the SVN client such as  Tortoisesvn for windows and Rapidsvn for Linux.

POSTS YOU MAY LIKE -:)

Share This Post

  • 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!!!

Shares