- Install a couple of packages via yum :
$ sudo yum install httpd subversion mod_dav_svn
- Create a directory to store the svn repositories in :
$ sudo mkdir -p /var/lib/subversion/repositories
$ sudo chown -R apache:apache /var/lib/subversion
- Because I make and delete repositories quite a lot, i made a script to build them. Save this script somewhere and make it executable. I saved it as /bin/make-repos so i can use it from anywhere.
#!/bin/sh
if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 repository_name
exit 127
fi
echo "Sudoing...";
sudo svnadmin create --fs-type fsfs /var/lib/subversion/repositories/${1}
sudo chown -R apache:apache /var/lib/subversion/repositories/${1}
sudo chmod -R g+w /var/lib/subversion/repositories/${1}
sudo chmod g+s /var/lib/subversion/repositories/${1}/db
- Create a new file /etc/httpd/conf.d/svn.conf with the following contents :
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn>
DAV svn
SVNParentPath /var/lib/subversion/repositories
SVNListParentPath on
SVNPathAuthz off
AuthType Basic
AuthName "subversion@tokyo"
AuthUserFile /var/lib/subversion/passwords
Require valid-user
</Location>
You may not need the first 2 LoadModule lines if they are already in your global httpd.conf.
- Create your password file:
$ sudo htpasswd -c /var/lib/subversion/passwords new-user-name
Where new-user-name is the name of the user you want to create.
- Restart Apache and you’re done!
$ sudo /etc/init.d/httpd restart
If you create a couple of repositories with your make-repos script and browse to http://your.server.domain/svn you should see a browsable list of the repositories you’ve created.