Apache mod-dav-svn on CentOS
From DTO Labs Knowledge Base
Here's how to get a new Subversion server up and running under Apache on CentOS:
Setup
- Install the mod_dav_svn RPM using Yum:
[root@ip-10-176-57-29 ~]# yum -y install mod_dav_svn . . . Installed: mod_dav_svn.x86_64 0:1.4.2-4.el5_3.1 Dependency Installed: httpd.x86_64 0:2.2.3-31.el5.centos.4 Complete!
- Make sure Apache will be up when you need it!:
[root@ip-10-176-57-29 ~]# chkconfig --level 2345 httpd on [root@ip-10-176-57-29 ~]# chkconfig --list httpd httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- Setup a reasonable default Apache configuration file. e.g:
- Use the example below..
[root@ip-10-176-57-29 conf.d]# cat /etc/httpd/conf.d/subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#
# Example configuration to enable HTTP access for a directory
# containing Subversion repositories, "/var/www/svn". Each repository
# must be readable and writable by the 'apache' user. Note that if
# SELinux is enabled, the repositories must be labelled with a context
# which httpd can write to; this will happen by default for
# directories created in /var/www. Use "restorecon -R /var/www/svn"
# to label the repositories if upgrading from a previous release.
#
#
# To create a new repository "http://localhost/repos/stuff" using
# this configuration, run as root:
#
# # cd /var/www/svn
# # svnadmin create stuff
# # chown -R apache.apache stuff
#
<Location /repos>
DAV svn
SVNParentPath /var/www/svn
# Limit write permission to list of valid users.
<LimitExcept GET PROPFIND OPTIONS REPORT>
# Require SSL connection for password protection.
# SSLRequireSSL
AuthType Basic
AuthName "Authorization Realm"
AuthUserFile /etc/svn-auth-file
Require valid-user
</LimitExcept>
</Location>
- Setup the repository:
[root@ip-10-176-57-29 www]# cd /var/www [root@ip-10-176-57-29 www]# mkdir svn [root@ip-10-176-57-29 www]# cd svn/ [[root@ip-10-176-57-29 svn]# svnadmin create dukesbank [root@ip-10-176-57-29 svn]# chown -R apache.apache dukesbank
- Set an initial username/password up for commits:
[root@ip-10-176-57-29 svn]# htpasswd -cb /etc/svn-auth-file build build Adding password for user build
- Start Apache:
[root@ip-10-176-57-29 svn]# service httpd start Starting httpd: [ OK ]
Test
- Checkout out the repository, add some paths and commit:
[root@ip-10-176-57-29 svn]# cd /tmp [root@ip-10-176-57-29 tmp]# svn checkout http://localhost/repos/dukesbank Checked out revision 0. [root@ip-10-176-57-29 tmp]# cd dukesbank/ [root@ip-10-176-57-29 dukesbank]# mkdir trunk branches tags [root@ip-10-176-57-29 dukesbank]# svn add * A branches A tags A trunk [root@ip-10-176-57-29 dukesbank]# export EDITOR=vi [root@ip-10-176-57-29 dukesbank]# svn commit . Authentication realm: <http://localhost:80> Authorization Realm Password for 'root': Authentication realm: <http://localhost:80> Authorization Realm Username: build Password for 'build': Adding branches Adding tags Adding trunk Committed revision 1.