Monday 2 April 2012

How to setup SVN server with httpd based on centos 6.2

Installing SVN server is quite a headache.
This is my installation steps based on centos 6.2

1. Install Httpd and Subversion
> yum install httpd mod_dav_svn subversion

2. Edit your httpd.conf (at least change your server name)
> vi /etc/httpd/conf/httpd.conf

3. Edit http's subversion.conf (path to svn repos, set auth type and password path)
> vi /etc/httpd/conf.d/subversion.conf

It should be something like this.
<Location /repos>
   DAV svn
   SVNParentPath /var/www/svn/repos
#
#   # Limit write permission to list of valid users.
#   <LimitExcept GET PROPFIND OPTIONS REPORT>
#      # Require SSL connection for password protection.
#      # SSLRequireSSL
#
### You can comment the lines here if you do not need auth
      AuthType Basic
      AuthName "Authorization Realm"
      AuthUserFile /etc/svn-auth-conf
#      AuthUserFile /path/to/passwdfile
      Require valid-user
#   </LimitExcept>
</Location>

4. Create user for svn (if you are using auth to commit / check out)
> htpasswd -cm /etc/svn-auth-conf yoursvnuser

5. Create svn a repo
> mkdir -p /var/www/svn
> svnadmin create /var/www/svn/repos
> chown -R apache.apache /var/www/svn/repos

6. Local commit to repo
> svn import /tmp/somefolder file:////var/www/svn/repos -m "Initial commit"

7. Start your httpd
> service httpd start

8. Try checking out from the newly created repo
> svn co http://yourdomain/repos

There, a workable new svn server.

No comments:

Post a Comment