Install & Configure Subversion on EC2 Amazon Linux

Install Subversion

sudo yum install mod_dav_svn subversion

Configure Subversion

  1. Edit virtual host file
    sudo vi /etc/httpd/conf.d/vhosts.conf
    
  2. Add a virtual host and edit the subversion access information
    <VirtualHost *:80>
            ServerName svn.yourdomain.com
            ServerAlias svn.yourdomain.com
            <Location "/" >
                DAV svn
                SVNPath /data/svn/repos
                AuthType Basic
                AuthName "Subversion repos"
                AuthUserFile /data/login/svn-auth-conf
                Require valid-user
           </Location>
    </VirtualHost>
    
  3. Create Subversion's user passwords
    sudo mkdir -p /data/login
    sudo htpasswd -cm /data/login/svn-auth-conf yourusername
    sudo htpasswd -m /data/login/svn-auth-conf otherusername
    ...
    

    Only use -c to create a new password file. All existing users in the password file will be removed.

  4. Change the owner and access mode for the password file
    sudo chown -R apache.apache /data/login
    sudo chmod 600 /data/login/svn-auth-conf
    
  5. Create a Subversion repository
    sudo mkdir /data/svn
    cd /data/svn
    sudo svnadmin create repos
    sudo chown -R apache.apache /data/svn
    
  6. Restart Apache
    sudo service httpd restart
    

Import Subversion Repository

  1. Dump the old repository
    svnadmin dump /var/svn/repos > repository.dmp
    tar cvzf repository.tgz repository.dmp
    
  2. Load to a new repository in a new machine
    tar -xzvf repository.tgz
    
    sudo svnadmin load /data/svn/repos < repository.dmp
    sudo chown -R apache.apache /data/svn