Notes
Powered by Gregarious (33)
Go to Post Index Blog Index
Subscribe Subscribe
Subscribe to RSS feed via Email Subscribe via Email
Sphere: Related Content
 

Setting up your very own Subversion repository

Filed under Programming, Tools.

Viewed 516 times times.

 

 

Recently, a network outage at the office kept me from accessing my remote Subversion repository, which in turn prevented me from finishing a relatively small project in the deadline I had set for it. This led me to consider the problems with depending on connectivity to the outside world, specially in a university campus where there seems to be outages on a semi regular basis.

Today, I finally surrendered and decided to configure my own Subversion server on one of the machines I run, instead of continuing to depend on a third-party one. The process was surprisingly painless, but it did imply some research, so I went ahead and documented the process for my (and yours) future reference.

I’m assuming you already have apache installed and functioning properly. If this is not the case, there are many tutorials online on how to do this. Let’s start by installing the mod_dav_svn apache module using yum (you should take a look at the yum man page if you are not familiar with this tool)

666
yum install mod_dav_svn

If you don’t already have the subversion client installed it will ask if it’s ok to install it as well. “Just say yes” when you see something like this:

Dependencies Resolved
 
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 mod_dav_svn             i386       1.2.3-2.1        updates-released   62 k
Installing for dependencies:
 subversion              i386       1.2.3-2.1        updates-released  2.1 M
 
Transaction Summary
=============================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 2.1 M
Is this ok [y/N]: y

and let yum take care of the rest. After all the necessary packages are installed, we must create the directory structure where svn will live, and make sure that this new directory tree has the right ownership.

666
667
668
669
670
mkdir /svn
mkdir /svn/repos
mkdir /svn/users
mkdir /svn/permissions
chown -R apache.apache /svn/

Here we are assuming that your apache server is running has user and group “apache”. You must change the last line accordingly if user and group ids are different in your case.

The only tricky part of the installation comes now, with the configuration of the Apache server. When you had yum install mod_dav_svn it created for you the /etc/httpd/conf.d/subversion.conf file. Now you must edit it so it reads like this:

1
2
3
4
5
6
7
8
9
10
11
LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
 
<Location /svn/repos>
   DAV svn
   SVNParentPath /svn/repos/
   AuthType Basic
   AuthName "Authorization Realm"
   AuthUserFile /svn/users/passwords
   Require valid-user
</Location>

Here you have to make sure that the paths match the ones you created in the previous steps. You will notice that we have specified a passwords file that will be responsible for storing the login information for the users allowed to access the repository, but that we still haven’t defined who these users are. We do this by using the htpasswd command:

666
htpasswd -cb /svn/users/passwords <username> <pass>

Where you should replace the and tags by the actual user name and passwords you wish to use. These can be set to anything you wish and are not limited to actual user accounts on your system. Complete documentation on the htpasswd can be found on it’s man page. The only thing that remains is for you to restart the apache web server with the new definitions using:

1000
1001
1002
service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

and if everything went as planned you should now be able to make use of your very own subversion repository.

The ultimate reference on installing, administering and using the svn system can be found on the “Version Control With Subversion” book you can access online. As usual, I would like to hear any comments or suggestions you might have about his post.

Sphere: Related Content




Leave a Reply




 

© Copyright 2004 Bruno Goncalves - All rights reserved

Valid XhtmlValid CSS

Socialized through Gregarious 33
Close
E-mail It