Setup an SVN Server on Ubuntu
  1. Start by installing SVN on Ubuntu
    1. sudo apt-get update
    2. sudo apt-get install subversion
  2. Now create a repository.  The repository is where all of your projects will be stored.
    1. NOTE: You may choose whatever directory location you want, /var is a good place
    2. sudo svnadmin create /var/svn
  3. At this time, we need to add a user to the repository.  This user will be the owner of the files in the repository.  When we add the user, we are also adding the group.
    1. sudo adduser svn
    2. However, this user is NOT a valid user to login to the system so we need to disable this account
    3. First, edit /etc/passwd and set the login shell to /bin/false
      1. sudo vi /etc/passwd
      2. Locate the svn line, and change /bin/bash to /bin/false
    4. Now we need to change the ownership of the svn repo to our new svn user account
      1. cd /var
      2. sudo chown -R svn.svn svn
  4. We now need to add each user to the svn group
    1. sudo adduser <yourusername> svn
  5. To make access to the SVN repository easier, you can create a symbolic link from the / to the repo
    1. cd /
    2. sudo ln -s /var/svn svn
  6. And set the permissions for access to your repo
    1. sudo vi /svn/conf/svnserve.conf
      1. Add add the following lines
      2. anon-access = none
      3. auth-access = write
      4. password-db = passwd
    2. sudo vi /svn/conf/passwd
      1. Add the following
      2. <username>=userpassword
      3. Save the file, and then
      4. sudo chmod 600 passwd
  7. We are now ready to make our first repository.  A test repository is nice because it lets you try out the various SVN commands without impacting anything legitimate.
    1. svn ls file:///svn    (which shows an empty repo)
    2. sudo svn mkdir file:///svn/testrepo -m "test repo"    (to create a repo names "testrepo")
    3. svn ls file:///svn     (which now shows our first repo)
  8. Setup svnserver to automatically start whenever your Ubuntu system starts
    1. cd /etc/init.d
    2. sudo vi svnserve
      1. svnserve -d -r /svn
    3. sudo chmod +x svnserve
    4. sudo update-rc.d svnserve defaults
    5. sudo svnserve -d -r /svn    (to start the svn server prior to reboot)
  9. If you are on a Windows client, then tortoisesvn is what you want
    1. http://tortoisesvn.net/
    2. Then right click in windows explorer, choose 'svn checkout', and type in the URL as
      1. svn://<servername>/testrepo
  10. I made a simple script to create a repo automatically
    1. vi mkrepo.sh
      1. #!/bin/bash
      2. echo "Enter name of repo:"
      3. read -e repo
      4. echo "Press <ENTER> when ready to continue"
      5. read -e junk
      6. sudo svn mkdir --parents file:///svn/$repo/{trunk,tags,branches} -m "initial repository creation"
    2. chmod +x mkrepo.sh