Subversion Server on CentOS

Subversion Server on CentOS

1. Install a couple of packages via yum:

$ sudo yum install httpd subversion mod_dav_svn

2. Create a directory to store the svn repositories in :

$ sudo mkdir -p /var/lib/subversion/repositories
$ sudo chown -R apache:apache /var/lib/subversion

3. 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.


if [ $# -ne 1 ]; then
echo 1>&2 Usage: $0 repository_name
exit 127

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

4. Create a new file /etc/httpd/conf.d/svn.conf with the following contents :

LoadModule dav_svn_module modules/
LoadModule dav_svn_module modules/

DAV svn
SVNParentPath /var/lib/subversion/repositories
SVNListParentPath on
SVNPathAuthz off
AuthType Basic
AuthName "subversion@tokyo"
AuthUserFile /var/lib/subversion/passwords
Require valid-user

You may not need the first 2 LoadModule lines if they are already in your global httpd.conf.

5. 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.

6. 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.


Popularne posty z tego bloga

Set up JBoss AS 5.1.0 and Seam 2.2.0 in Ubuntu 9.04