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/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#
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.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL
      AuthType Basic
      AuthName "SVN-Authorization"
      AuthUserFile /var/www/svn/svn-auth-file
      Require valid-user
   </LimitExcept>
</Location>

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
</Location>
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 http://myserver.com/svn/test -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: http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html
Here is a good place to start: http://www.daniel-skinner.co.uk/setup-subversion-and-trac-on-centos-5/06...
Also: http://wiki.centos.org/HowTos/Subversion

For a note on permissions problems, see: http://www.readingtype.org.uk/blog/2008/08/brief-apache-229subversion-14...

Topic: