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

4

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 Test Page
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 - Apacahe SVN Authentication
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
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
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
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.

Further Reading

You might also like

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

4