How To Configure Web Access To Subversion Repositories Using Apache
How To Configure Web Access To Subversion Repositories Using ApacheThis how to is going to describe the steps to get the mod_dav_svn module to work in an Apache web server. First I'll assume that we don't have Apache and Subversion installed on our FreeBSD box, in a second part I'll explain how to add the module using our current installation. First we have to install our Apache 2.0.x with Berkeley DB support (because Subversion will use Berkeley DB to save the repositories). To do this we have to go to the ports dir and do this: box# cd /usr/ports/www/apache20/ Add apache ability to start automatically at boot time: box# echo 'apache2_enable="YES"' >> /etc/rc.conf After we have apache20 installed with bdb support, we'll have to install Subversion: box# cd /usr/ports/devel/subversion After installation we'll have to ensure that mod_dav_svn module was properly installed on apache. box# cat /usr/local/etc/apache2/httpd.conf | grep svn LoadModule dav_svn_module libexec/apache2/mod_dav_svn.so We have apache with mod_dav_svn module installed properly. At this point we can create a repository. This will help us to test our instalation: box# mkdir /usr/home/svn Then we have to create the files that are going to be used to authenticate the users. box# mkdir /usr/home/svn/access box# vi control [test:/] root = rw viewer = r At this point we have apache with bdb support, subversion with mod_dav_svn module installed, our repository created, the users and the control to our repository. Now we will configure apache to read the repositories: box# cd /usr/local/etc/apache2/Includes/ <Location /svn/repos> Apache will read all the files that are under the Includes directory, so our svn.conf will be loaded when apache starts, note that we are loading svnindex.xsl that is the file where the transformations are done, if you would like to give to your repository some look and feel work these file will be the appropiate. The file skeletons are under /usr/local/share/subversion/xslt/ directory, there are two files, one .xsl and another .css. Copy these files to your document root. I have a virtual server called svn.example.com in my machine. I have all my virtual servers under /usr/local/www/pages, so I have svn.example.com directory and I've configured that virtual server in /usr/local/etc/apache2/httpd.conf. NameVirtualHost *:80 Restart the web server: /usr/local/etc/rc.d/apache2.sh restart If all went ok, we have our web server working properly, to test it, open in your Firefox or whatever browser and go to http://svn.example.com/svn/repos/test. It will ask you for the credentials, so use root or viewer. It must display the test repository at revision 0. I'll suggest to install TortoiseSVN on Windows boxes to get access to the repositories. Now, as a plus, we will configure an alert in our subversion test repository to send a notification when a commit was done. To do this we will have to create an executable file under the hooks directory: box# cd /usr/home/svn/repos/test/hooks/ [code] To get this to work with your current installation you have to change only the subversion installation step: box# cd /usr/ports/devel/subversion Ok, this is the end of this howto, any improvements are welcome. Regards!
|







Recent comments
17 hours 38 min ago
22 hours 13 min ago
1 day 22 hours ago
2 days 2 hours ago
3 days 22 min ago
3 days 3 hours ago
3 days 14 hours ago
3 days 14 hours ago
4 days 19 hours ago
6 days 14 hours ago