Installing Subversion Server on CentOS

1. Install a couple of packages via yum:

[code lang="shell"]
$ sudo yum install httpd subversion mod_dav_svn
[/code]


2. Create a directory to store the svn repositories in :
[code lang="shell"]
$ sudo mkdir -p /var/lib/subversion/repositories
$ sudo chown -R apache:apache /var/lib/subversion
[/code]


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.
[code lang="shell"]
#!/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
[/code]


4. Create a new file /etc/httpd/conf.d/svn.conf with the following contents :
[code lang="shell"]
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule dav_svn_module modules/mod_authz_svn.so


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




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

5. Create your password file:
[code lang="shell"]
$ sudo htpasswd -c /var/lib/subversion/passwords new-user-name
[/code]



Where new-user-name is the name of the user you want to create.

6. Restart Apache and you’re done!
[code lang="shell"]
$ sudo /etc/init.d/httpd restart
[/code]


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.
[http://recurser.com/articles/2008/03/27/subversion-server-on-centos/]

Komentarze

Popularne posty z tego bloga

Set up JBoss AS 5.1.0 and Seam 2.2.0 in Ubuntu 9.04