Ubuntu setup SVN


Ubuntu setup SVN

This SVN installation was set up in Ubuntu 16.04 LTS. Before starting the installation run the update command. I previously wrote a longer guide on how to set up Apache in AWS EC2, you can read it if this is too brief for you.

sudo apt-get update

Setup Apache

To install Apache web server, type the commands below. If you already have Apache installed, you can skip this step.

sudo apt-get install apache2

Install SVN server

To install SVN server, type:

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

Configure SVN

Edit the config file located at /etc/apache2/mods-enabled/dav_svn.conf

<Location /svn>

DAV svn
SVNParentPath /var/svn

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

</Location>

Enable DAV and restart Apache.

sudo a2enmod dav
sudo a2enmod dav_svn
sudo service apache2 restart

Create Repository

I’ll be creating a repository for my Android app SMS Gateway ( free ) in this example.

sudo mkdir -p /var/svn/
sudo svnadmin create /var/svn/smsgateway

sudo chown -R www-data:www-data /var/svn
sudo chmod -R 775 /var/svn

Create Users

To create the first user and the password file, type the following command:

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

To create more users, use the command below. Notice that I have omitted the “c”. If you keep using the “c” it will keep overwriting your password file and you will always have one user.

sudo htpasswd -m /etc/apache2/dav_svn.passwd foo
sudo htpasswd -m /etc/apache2/dav_svn.passwd bar

Test SVN

To test if you had configured your SVN server correctly. Open your web browser and type in the configured URL. In my case it is https://svn.oofnivek.com/svn/smsgateway/

A brand new installation will begin with revision 0. I had committed some codes and it is currently at revision 3. After testing a few SVN clients, my favorite is still TortoiseSVN.

 

ubuntu setup svn
Testing a successfully setup SVN server using web browser.