Ubuntu Server: Steps to Create a New SVN Repository and Add Users for it

To add SVN repositories and give existing user accounts access to it is not entirely a one step process in Ubuntu. So this is how you do it…

First, browse to the folder in which you want to generate your SVN repository and create the respository folder:

cd /home/svn
mkdir projectname

Next, instruct SVN to generate the necessary file structures required into your repository folder:

sudo svnadmin create projectname

Once this has completed, the next step is to open up the repository to the world by making use of the Apache web server. To do this, we need to assign the necessary folder access permissions:

sudo chown -R www-data:svn projectname
sudo chmod -R g+rws projectname

Next, we need to add the new SVN repository details under Apache’s configuration:

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

Add to the bottom of the file:


      DAV svn
      SVNPath /home/svn/projectname
      AuthType Basic
      AuthName "Projectname SVN Repository"
      AuthUserFile /etc/subversion/passwd

      Require valid-user

Note the statement. If you wish to run a tight ship and force authentication for all actions, you would drop the LimitExcept call and use only the “Require valid-user” statement on its own.

And finally? Restart the Apache service.

sudo /etc/init.d/apache2 restart

To give existing user accounts access to the SVN repository, you need to add them to the subversion password file:

sudo /etc/subversion/passwd passwd username

(You will be prompted to enter a password)

Done!

You might also enjoy:

About Craig Lotter

Craig Lotter is an established web developer and application programmer, with strong creative urges (which keep bursting out at the most inopportune moments) and a seemingly insatiable need to love all things animated. Living in the beautiful coastal town of Gordon's Bay in South Africa, he games, develops, takes in animated fare, trains under the Funakoshi karate style and for the most part, simply enjoys life with his amazing wife and daughter. Oh, and he draws ever now and then too.
This entry was posted in Tutorials and tagged , , , , . Bookmark the permalink.
    blog comments powered by Disqus