Wednesday, February 13, 2008

Installing subversion with apache on centos

A step by step guide on installing subversion with http support on centos and redhat machine

  1. First of all, install apache/httpd
    • yum install httpd
  2. Make sure you apache is running. You can also type 'http://localhost' at your browser and apache test page should appear if your apache is running
    • /etc/init.d/httpd status
  3. Make it start by default on startup
    • chkconfig httpd on
  4. Edit the apache configuration to suit your need. If not sure, leave the default setting as it is
    • vi /etc/httpd/conf/httpd.conf
  5. Install subversion and mod_dav_svn for apache
    • yum install mod_dav_svn subversion
  6. Go to subversion.conf in /etc/httpd/conf.d/. Edit as below
    • cd /etc/httpd/conf.d/
    • vi subversion.conf
      1. This is the most basic configuration where anyone will have unrestricted access to the repos. Location is the name that will be used in the browser address bar. In this example it will be 'http://localhost/svn/repos' (Click for larger image)
      2. This is a configuration with username and password for the client (Click for larger image)
    • htpasswd -cm /etc/svn-auth-conf --- This command is not needed for the first configuration. To create the first user with password
    • htpasswd -m /etc/svn-auth-conf --- use this command to add another user
  7. Configure your repository
    • mkdir /var/www/svn --- create folder svn
    • cd /var/www/svn --- change diectory to the newly created svn directory
    • svnadmin create repos --- create svn repository named repos
    • chown apache.apache -R repos --- change ownership of 'repos' to apache
    • /etc/init.d/httpd restart --- restart apache
  8. Open you browser and type 'http://localhost/svn/repos'. You can see that a page with 'Revision 0:/' will appear. Congratulation, you just completed the setup for svn server with http.

9 comments:

  1. I did same thing but ...
    but my browser showing

    403 error

    Forbidden

    You don't have permission to access

    ReplyDelete
  2. Hi anonymous,

    May I know after which step that your browser come out with the '403 error'?

    ReplyDelete
  3. This saved me a lot of time! Good write up. Thanks for posting it.

    ReplyDelete
  4. Don't forget about changing SE Linux, it can mess this up.

    ReplyDelete
  5. AnonymousJuly 20, 2010

    Follow the instructions here:

    http://wiki.centos.org/HowTos/Subversion

    Make sure the subversion.conf is exactly like they say.

    ReplyDelete
  6. Anonymous Anonymous said...
    I did same thing but ...
    but my browser showing
    403 error
    Forbidden

    Please check your folders structure.

    I'm sure it is not correctly configured.

    Also try to use
    SVNPath /var/svn/www/repos property.

    ReplyDelete
  7. Amazing....this work for me :)

    shailesh

    ReplyDelete
  8. AnonymousMay 01, 2012

    using
    SVNPath /var/www/svn/repos

    did the trick :D

    ReplyDelete
  9. Thank you soo much, u saved me hours of pain.

    ReplyDelete