You are here

Install Subversion on CentOS 5 with Apache

yum install subversion mod_dav_svn
mkdir -p /var/www/svn/test #place to keep repository
svnadmin create --fs-type fsfs /var/www/svn/test #make a test one
chown -R apache.apache /var/www/svn
vim /etc/httpd/conf/httpd.conf #make sure the following two lines are there
LoadModule dav_svn_module modules/
LoadModule authz_svn_module modules/
vim /etc/httpd/conf.d/subversion.conf #and add the following

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   # Limit write permission to list of valid users.
      # Require SSL connection for password protection.
      # SSLRequireSSL
      AuthType Basic
      AuthName "SVN-Authorization"
      AuthUserFile /var/www/svn/svn-auth-file
      Require valid-user

htpasswd -cm /var/www/svn/svn-auth-file andrew # -c creates the first time
service httpd restart
chkconfig httpd on
# to use digest:

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   AuthType Digest
   AuthName "SVN-Authorization"
   AuthDigestDomain /svn/
   AuthUserFile /var/www/svn/svn-digest-file
   Require valid-user
htdigest -c /var/www/svn/svn-digest-file SVN-Authorization andrew #and use this instead

#NOTE: to avoid Apache confusing the subversion domain with an already existing virtual domain, make sure there is no overlap. E.g. use a separate virtual domain name for the SVN site. (This can resolve to a simple test page for http requests.)
#test it out with:
svn import --username andrew mytree -m "initial import"
svn checkout --username andrew http://anastasis/svn/test kcpp
#to create another repository:

REP=/var/www/svn/test2;svnadmin create $REP; chown -R apache.apache $REP
svn mkdir file://$REP/trunk -m "create trunk";
svn mkdir file://$REP/tags -m "create tags";
svn mkdir file://$REP/branches -m "create branches";
svnlook tree $REP #look at it

Official guide:
Here is a good place to start:

For a note on permissions problems, see: