How to install SVN server on Ubuntu (via dav_svn aka apache module)

Well, well, well. Today we are going to install subversion on Ubuntu server in a few easy steps.

Step1: install all necessary software (considering Apache is up & running already)

sudo apt-get install subversion libapache2-svn

Step 2: Adding new user called “svn”

sudo useradd -d /home/svn -m svn

sudo passwd svn

Step 3: creating repository

sudo svnadmin create /var/svn/reponame

Step 4:
EDIT:  /etc/apache2/mods-enabled/dav_svn.conf and add following lines on the bottom of it:

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

NOTE: there is a commented line SVNPath – this will be used if you want to use only one repository, in our sample we use SVNParentPath /var/svn which is parent of all our future repos.

Step 5: now we creating new user for apache

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

Note: that you should only use the -c option the FIRST time that you create a user.
After that you will only want to use the -m option, which specifies MD5 encryption of the password, but doesn’t recreate the file.

Step 6: restart Apache

sudo service apache2 restart

Now you can access your repository via url http://servername.com/svn/reponame

Small additions:

1: If you want to add new user
htpasswd /etc/apache2/dav_svn.passwd new_username

2: Change permissions in order system be able to access your svn
sudo chown -R www-data:www-data /var/svn/

 

 

THE END 🙂

Posted on April 1, 2013 at 13:54 by arte · Permalink
In: Uncategorized

Leave a Reply