Installing SVN and Apache on Centos 5

Having done this many times already, here’s a quick recipe for putting Subversion (with Apache) on a fresh install of CentOS 5.5. It assumes you will put your repositories into /var/svn/repositories, the user credentials are held in /var/svn/passwords, you will have a user called testuser and an initial blank repository called myrepos. I’ll also assume your server is called The procedure also opens port 80 in the iptables firewall. Edit the details to suit your own requirements:

# yum install httpd subversion mod_dav_svn
# mkdir -p /var/svn/repositories
# chown -R apache:apache /var/svn
# chcon -R -h -t httpd_sys_content_t /var/svn
# htpasswd -c /var/svn/passwords testuser
  * enter password for 'testuser' (twice)
# vi /etc/httpd/conf.d/subversion.conf
  * Uncomment the <Location> config lines
  * <Location /repositories>
  * SVNParentPath /var/svn/repositories
  * AuthName "Test Realm"
  * AuthUserFile /var/svn/passwords
# svnadmin create --fs-type fsfs /var/svn/repositories/myrepos
# chown -R apache:apache /var/svn/repositories/myrepos
# chmod -R g+w /var/svn/repositories/myrepos
# chmod g+s /var/svn/repositories/myrepos/db
# chkconfig httpd on
# vi /etc/sysconfig/iptables
  Just before the REJECT line, verify/add this line:
  -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# service iptables restart
# service httpd start

At this point you can browse to or check out the (empty) repository in your favourite SVN client or IDE. Administering the new SVN server is out of scope for this little recipe, but I hope it helps get you started.

(I can’t imagine this will be much different when CentOS 5.6 is released.)

Categorised as: Coding, Operating Systems, Web

Comment Free Zone

Comments are closed.