Creating and populating repositories

The repository directories need the proper permissions for apache and the other users. I'll make a group and add users to it (don't just copy/paste here). The apache user won't be put in the group because I find it less secure.

The server example.com is the server we installed
Subversion on. For easy ssh use you can chose not to use a passphrase
with your key or use an agent to keep authenticated. Otherwise each
transaction between the user machine and Subversion will require the
user to enter a password (very inconvenient). Using an agent can be
done like this:

You can uncomment the SSLRequireSSL file if you don't want to use SSL, but then you need to use http and not https
in the commands that follow. Apache should be restarted and we can test
from a user machine. We'll import the same testfile in the wombat
project.

Using a webbrowser you can visit your URL https://example.com/svn_wombat
and see what was just committed. This is a basic on-line view on the
repository, but using a web font-end like websvn will offer a better
repository browsing experience.

Setting up websvn

Required packages

To get rolling with websvn we'll need to install the following
packages, both will show you configuration screens (explained in the
next paragraph):

# apt-get install enscript
# apt-get install websvn

Enscript isn't mandatory but we'll need it for syntax coloring in websvn.

Configuration

Enscript will ask for paper size, this might seem awkward
but that's because enscript is also used for converting ASCII files to
PostScript. We need it for it's syntax coloring features.

Websvn will first ask for which kind of server to configure, go ahead and just press enter.

The next screens ask for a parent repository folder (/var/svn-repos/
in this case) and specific repository folders, this will determine
which repositories will show up in websvn. We will only enter a parent
repository, all repositories created in this folder will show up in
websvn for users to browse. If you want to show only specific
repositories enter their full paths in the second screen and leave the
parent path blank.

As a result the file /etc/websvn/svn_deb_conf.inc will be written. You can rerun debian package configuration screens with dpkg-reconfigure. Further websvn configuration is done in the file /etc/websvn/config.inc. This is the content of my file with some extension mappings for the syntax coloring.

<?php // --- LOOK AND FEEL --- // // Uncomment ONLY the display file that you want. $config->setTemplatePath("$locwebsvnreal/templates/Standard/"); // $config->setTemplatePath("$locwebsvnreal/templates/BlueGrey/"); // $config->setTemplatePath("$locwebsvnreal/templates/Zinn/"); // $contentType[".c"] = "plain/text"; // Create a new association // $contentType[".doc"] = "plain/text"; // Modify an existing one unset($contentType[".sh"]); // Remove a default association -> .sh is regarded as a binary file by default, needs to be unset // --- COLOURISATION --- // Uncomment this line if you want to use Enscript to colourise your file listings // // You'll need Enscript version 1.6 or higher AND Sed installed to use this feature. // Set the path above. // $config->useEnscript(); // Enscript need to be told what the contents of a file are so that it can be colourised // correctly. WebSVN includes a predefined list of mappings from file extension to Enscript // file type (viewable in setup.inc). // // Here you should add and other extensions not already listed or redefine the default ones. eg: // // php is default correctly colourized $extEnscript[".java"] = "java"; $extEnscript[".pl"] = "perl"; $extEnscript[".py"] = "python"; $extEnscript[".sql"] = "sql"; $extEnscript[".java"] = "java"; $extEnscript[".html"] = "html"; $extEnscript[".xml"] = "html"; $extEnscript[".thtml"] = "html"; $extEnscript[".tpl"] = "html"; $extEnscript[".sh"] = "bash"; // --- MISCELLANOUS --- // Uncomment this if you don't have the right to use it. Be warned that you may need it however! set_time_limit(0); // Comment this line to turn off caching of repo information. This will slow down your browsing. $config->setCachingOn(); // Number of spaces to expand tabs to in diff/listing view across all repositories $config->expandTabsBy(8); // To change the global option for individual repositories, uncomment and replicate // the required line below (replacing 'myrep' for the name of the repository to be changed). // $config->findRepository("myrep")->expandTabsBy(3); // Expand Tabs by 3 for repository 'myrep' ?> <?php if ( file_exists("/etc/websvn/svn_deb_conf.inc") ) { include("/etc/websvn/svn_deb_conf.inc"); } ?>

Next up is configuring the apache virtualhost for websvn.
Example using SSL:

Suggested articles

50 Comment(s)

Comments

I've tried at least 4 or 5 other subversion installation documents with little to no success. Most of the time Apache would never configure properly. Props to you! Finally an installation document that works and makes sense.

Agreed. This is one of the mistake I found as well in this tutorial.I wonder how all other users said; "Great, worked perfectly for me!".Unfortunately it does not work for me and I suspect some more errors and missing information in this tutorial. Thanks anyway. I remains one of the best tutorial I found on the web.

Debian Sarge uses SVN 1.1 which has the BDB filesystem as the default for new repositories. However, since SVN 1.2 the FSFS filesystem has become the new default. So, to be as futureproof as possible , I suggest that You change the repository creation commands as follows:

[email protected]:~/.ssh$ ssh-keygen -t dsaGenerating public/private dsa key pair.Enter file in which to save the key (/home/faizan/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/faizan/.ssh/id_dsa.Your public key has been saved in /home/faizan/.ssh/id_dsa.pub.

http://svnbook.red-bean.com/en/1.5/index.html which is the definitiveanswer. It appears that the options order has changed and so was ableto import with svn import ~/TEMP/ http://example.co.uk/svn_wombat -m 'testing over http'

Everything worked perfectly, everything is set up just how I needed it. I didn't do the webSVN, don't think i'll need it soon, but I couldn't have asked for better instructions for the rest of it. Way big thanks.

Note that the DocumentRoot paths in your apache config files could be different to /var/www/websvn. If you get an error when restarting apache, try finding your actual websvn directory using something like:

Is this article still relevant concerning securcurity 8 years after? It's very helpful and I'm setting up my SVN server per these instructions but I'd like to make changes for updated security enhacements as I go, if there are any.

I followed this tutorial and now have all myy repositories available through the repository root. I need to have each repository discrete from each other so users can access only the particular one we give them credentials to.

From what I read here each repo should be available using https://svn.example.com/repo-name but I'm getting a forbidden error:

Forbidden

You don't have permission to access /helpDocs on this server.

As I said, I can see and access all the repositories under https://svn.example.com but that gives all users access to all repostiories and the SVN software we use for documentation needs https://svn.example.com/repo-name.

I could post my config files here but this thread is pretty old, not sure if anyone will see this anyway...