Subversion Setup

This is not a tutorial. That would imply I know something that I really don't. I had fits trying to set up my server - I kept getting errors. Subversion is known for providing very specific error messages completely without context. This is more a notepad on what I wound up doing. To begin, though, I will describe my setup. I have a workstation. I develop code for linux, iOS, and web on it. I was backing it up to a network drive, but that was problematic. I have a server that gets used once in a while. I upgraded it with a Core2 quad, 4GB of RAM, and I power it up every time I power up the workstation.

Subversion was installed through the package manager on the workstation, and on the command line on the server. On the server, I made a directory structure using svnadmin:

The commands:

  1. dallmon@dev:/ # mkdir www
  2. dallmon@dev:/ # svnadmin create www
  3. dallmon@dev:/ # cd www
  4. dallmon@dev:/www/ # mkdir dave
  5. dallmon@dev:/www/ # mkdir vtr

The "svnadmin create www" command created a bunch of files in the www directory. Of interest are:

  1. "/www/conf/authz"
  2. "/www/conf/passwd"
  3. "/www/conf/svnserve.conf"

First edit the /www/conf/authz file. It will loook like this already:


### This file is an example authorization file for svnserve.
### Its format is identical to that of mod_authz_svn authorization
### files.
### As shown below each section defines authorizations for the path and
### (optional) repository specified by the section name.
### The authorizations follow. An authorization line can refer to:
###  - a single user,
###  - a group of users defined in a special [groups] section,
###  - an alias defined in a special [aliases] section,
###  - all authenticated users, using the '$authenticated' token,
###  - only anonymous users, using the '$anonymous' token,
###  - anyone, using the '*' wildcard.
###
### A match can be inverted by prefixing the rule with '~'. Rules can
### grant read ('r') access, read-write ('rw') access, or no access
### ('').

[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r

At the bottom add:


[/]
* = rw

This allows everyone access to the root of the repository. Don't worry yet.

The next file to edit is "/www/conf/passwd". It will look like this:

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.

[users]
# harry = harryssecret
# sally = sallyssecret

You will want to add the username and password you will be using.

dallmon = r7u!ssd1

No, that's not my password. But you would put yours there.

Finally, the big file, "/www/conf/svnserve.conf". It is fat with coments, and all of the options are commented out, too. You will be adding things to the "[general]" section first:

password-db = /www/conf/passwd
authz-db = /www/conf/authz

Then you start the server. "svnserve -d -r /www". That tells it to run in daemon mode, and serve the /www repository. Then to the workstation. You already installed the svn client. You will now configure it. In your home directory there is a hidden directory named ".subversion". There are several files and a directory. You only want to change one file: ".subversion/servers". It is a big file. A couple of lines up from the bottom you will find two items:

# store-passwords = yes
# store-plaintext-passwords = no

Uncomment those two lines, and see that they both say "no". I suspect only the top one is needed, but I did both.

store-passwords = no
store-plaintext-passwords = no

Change to the /www directory. Now you should be able to connect with the svn server:

"svn list svn://10.0.1.18/www"

Which in my case yields:

dallmon@poopster:~$ svn list svn://10.0.1.18/www
dave/
vtr/

Now you are ready to start importing your files. To do that, given the structure I have, I would go to the /home/dallmon/www directory on the workstation. It would be whatever directory has "dave/" and "vtr/" in it.


dallmon@poopster:/var/www/$ svn import -m "Initial import." dave svn://10.0.1.18/www/dave

That is really it. However, if you get odd svn authorization errors, be discerning. Their meanings are not obvious.

I hope that helps if you have problems. To auto start the svn server on boot, see:

  1. Get an init file from near the bottom of this article: Setting Up an Ubuntu Subversion Server
  2. Install it with the instructions from this article.