First one should naturally install subversion and apache in to the system and while installing make sure that mod_dav option is enabled in apache package and that mod_dav_svn option is enabled in subversion.
There is two ways to setup the mod_dav_svn with apache depending on whether you plan to have one or multiple repositories within single URI. For single repository the you should add in to httpd.conf the following:
## SVN WebDAV Repository Setup <Location /svn> DAV svn SVNPath /home/svn/repos SVNIndexXSLT "http://www.myservername.com/svnindex.xsl" # authenticating them valid ones Satisfy All Require valid-user AuthType Basic AuthName "Subversion Repositories" AuthUserFile /home/svn/access/users </Location>
For multiple repositories add following in to httpd.conf:
## SVN WebDAV Repository Setup <Location /svn> DAV svn SVNParentPath /home/svn/repos SVNIndexXSLT "http://www.myservername.com/svnindex.xsl" # authenticating them valid ones Satisfy All Require valid-user AuthType Basic AuthName "Subversion Repositories" AuthUserFile /home/svn/access/users </Location>
The default svnindex.xsl and svnindex.css can be found and copied from the subversion source package under subversion-<VERSION-NUMBER>/tools/xslt/.
Create the users using the htpasswd utility when adding the first user add -c after the htpasswd command in order to create the password file and for the following users you should remove the -c option:
# htpasswd /home/svn/access/users <username>
Building repository in the single repository configuration. The repository needs to be writable by the user or group to which the apache process belongs to.
# svnadmin create /home/svn/repos # svn import /home/<where_ever_you_have_initial_files> \ file:///home/svn/repos -m "initial import" # cd /home/svn # chown -R www repos
Building repository in the multiple repository configuration. The repository needs to be writable by the user or group to which the apache process belongs to.
# svnadmin create /home/svn/repos/<PROJECT_NAME> # svn import /home/<where_ever_you_have_initial_files> \ file:///home/svn/repos/<PROJECT_NAME> -m "initial import" # cd /home/svn/repos # chown -R www <PROJECT_NAME>
In the single repository configuration you can access the repository through web browser simply by writing in to the location bar the http://www.myservername.com/svn, but in the multiple repository configuration you must also add the project name after e.g. http://www.myservername.com/svn/<PROJECT_NAME> simply accessing the parent directory will result in to permission denied page to displayed so listing of repositories is not possible.