How to copy Subversion repositories to another server

  1. Ensure you have a working Subversion installation with Apache installed on your system.
  2. On the source machine, dump each repository:
    > svnadmin dump /path/to/repository > repository-name.dmp
  3. Copy repository-name.dmp to the target server.
  4. Load the repository into the new server:
    > cd /path/to/new-repository
    > svnadmin create repository-name
    > svnadmin load repository-name < repository-name.dmp
    
  5. Reassign apache permissions:
    > chown -R apache.apache repository-name
  6. You are now ready to begin using your repository on the new server!

How to install Subversion with Apache HTTPD

  1. Ensure you have Apache installed on your system.
  2. Ensure you have mod_dav_svn installed:
    > yum -y update mod_dav_svn
  3. Install ssl support to enable https:
    > yum install mod_ssl
  4. Edit /etc/httpd/conf.d/subversion.conf and append the following lines to the end of your config file:

    <Location /svn>
    DAV svn
    SVNParentPath /var/svn
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /etc/svn-auth-file
    AuthzSVNAccessFile /etc/svn-serve.conf
    Require valid-user
    </Location>

  5. Create a file called /etc/svn-auth-file
    Assign permission:

    > chown root.root /etc/svn-auth-file
    > chmod 644 /etc/svn-auth-file

  6. Add users to /etc/svn-auth-file (one per line) in the form:
    tom:$apr1$hDMIx…$abctozvZbC9J6/heHBBe481You can use htpasswd to do this automatically:

    > ### First time: use -cm to create the file
    > ### Use -m to use MD5 encryption of the password, which is more secure
    > htpasswd -m /etc/svn-auth-file harry
    New password: *****
    Re-type new password: *****
    Adding password for user harry
    > htpasswd /etc/svn-auth-file -m sally
    New password: *******
    Re-type new password: *******
    Adding password for user sally
    >

  7. Create a file called /etc/svn-serve.conf
    Fill it with:

    [/]
    *=
    svnUser=rw


    The user svnUser is being granted read and write access to all projects, while all other users (*) are being denied access.

  8. Assign permissions:

    > chown root.apache /etc/svnserve.conf
    > chmod 640 /etc/svnserve.conf

  9. Create /var/svn.

    > mkdir -p /var/svn
    > chmod 755 /var/svn

  10. If you are running SELinux, run:

    > chcon -R -h -t httpd_sys_content_rw_t /var/svn
    > setsebool -P httpd_unified=1

  11. You are now ready to being adding Subversion repositories!