Setting up Subversion on Mac OS X 10.5
I recently began working exclusively on an iMac so I decided to setup a subversion server locally and as my new machine would simply replace my local development machine, which is a Fedora Core 6 pc.
You’ll need to setup at least one repository. I’m going to need multiple repositories that I can use for different clients so I have a bit of extra admin work ahead of me. You can setup as many repositories as you need, but no matter what you’ll need at least one. Here create the folders…
# mkdir /svn
# mkdir /svn/repos
Then we need to tell subversion to make our first repository.
# svnadmin create /svn/repos/myproject
First, I need to setup a config file for svnserve.
# vi /svn/repos/conf/svnserve.conf
Then, look for variations of the following code and edit it as necessary. By default any anonymous user can access the code so to disable that you must include anon-access = none, just commenting the value out will not prevent anonymous access.
anon-access = none
password-db = passwdfile
realm = My SVN Repository
auth-access = write
The password-db is just a path to a file containing usernames and passwords. You’ll create this file especially for SVN. I create each file inside of the repository conf directory. So, save your changes and then we’ll create said user file.
# vi passwdfile
Enter in something like:
[users]
username = password
Anyway, you’ll need to start the svn server.
# svnserve -d --listen-port=3690
One side note - svnserve just runs and doesn’t have a way to stop besides killing the process. If you make changes to the svnserve.conf or user file you’ll need to restart svnserve.
# killall svnserve
Then, go ahead and test (best to do so on a different machine).
# svn co --username=myusername svn://mydomain/svn/repos/myproject
The system should then ask you for your password. Go ahead and run some tests.