You can serve svn repository with apache with easy steps as below:
1. Install svn module for apache:
with yum : yum install mod_dav_svn
This will install mod svn to apache.
2. Check httpd.conf and set-up mod svn
LoadModule dav_svn_module modules/mod_dav_svn.so
For this you should have mod_dav already loaded in httpd.conf file.
3. Add a Location directive as below:
<Location /svnserve> # svnserve is the name with wich you'll be accessing the repository DAV svn SVNPath /svn/projects/ #this will be the path to your svn repository. i have installed svn at the root folder so the path is /svn/projects where projects is the repo name. #if you need to password protect your repository you can consider adding the below AuthType Basic AuthName "Svn repository" AuthUserFile /svn/projects/conf/svn-auth-file Require valid-user </Location>
With this you’ll be able to access the repository in the browser as http://
Creating the file for the first time
htpasswod -cmd /svn/projects/conf/svn-auth-file <user-name>
Adding more user to the file
htpasswod -md /svn/projects/conf/svn-auth-file <user-name>
Now the repository will ask for a valid user first.
If you are having 403 “Forbidden” error then it is possible that the repository do not have sufficient privileges. You can check the permissions to the directory and other files. For a quick fix you can override them by using the below commands:
chcon --reference=/var/www/html -R /svn/projects #where /var/www/html is the directory served by apache
check them again:
ll -Z /svn/projects
It should show the result something as below
drwxr-xr-x apache apache system_u:object_r:httpd_sys_content_t /svn/projects
and hit refresh in the browser. You should be able to acces the repository now.