Setup SVN Server

  1. Install Subversion
    • Red Hat/CentOS/Fedora
    • sudo yum install subversion
    • Debian Based (Ubuntu)
    • sudo apt-get install subversion
  2. Create a repository
  3. sudo mkdir /data01/svn
    sudo mkdir /data01/svn/repos
    sudo svnadmin create /data01/svn/repos/new_repo

  4. Create an SVN group (add whichever users you would like to it)
  5. sudo groupadd svn
    sudo usermod -a -G svn svn_user

  6. Create svn user as part of the svn group.
  7. sudo useradd -g svn svn

  8. Give the new group ownership of the repos directory and set the permissions.
  9. sudo chown -R svn:svn /data01/svn
    sudo chmod -R 775 /data01/svn

  10. Create a wrapper for svnserve at /data01/svn/
  11. #!/bin/sh 
    # set the umask so that files are group writable
    umask 002
    # call svnserve, passing the default repo location
    exec /usr/bin/svnserve "$@" -r /data01/svn/repos

  12. Symlink to /usr/local/bin. Set permissions appropriately.
  13. cd /usr/local/bin/
    sudo ln -s /data01/svn/ svnserve
    sudo chmod 755 /data01/svn/

Setup Key-Based Authentication

  1. Create public/private key pair using ssh-keygen on local machine.
  2. svn@cwch3wnsapvl001:/home/svn$ ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/data01/home/svn/.ssh/id_rsa):
    Created directory '/data01/home/svn/.ssh'.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /data01/home/svn/.ssh/id_rsa.
    Your public key has been saved in /data01/home/svn/.ssh/
    The key fingerprint is:
  3. Copy the public key to remote host with ssh-copy-id
  4. ssh-copy-id -i ~/.ssh/ user@remote-host
  5. Test login from remote-host. Verify that it is now passwordless
  6. user@localhost:~$ ssh