Eric D. Schabell: Ubuntu Apache and Subversion setup with DAV support (includes SVN migration)

Friday, May 4, 2007

Ubuntu Apache and Subversion setup with DAV support (includes SVN migration)

Today I spent some time migrating data from one subversion repository to another. The first thing I needed to do was to setup my Ubuntu machine (Feisty x86_64) with a new Subversion with DAV installation. I already had Apache2 installed so it was just a matter of getting the Subversion installed and configured as follows:

# first install subversion and apache libs.
#
$ sudo aptitude install subversion libapache2-svn

# next we need a repository, I like to store all my
# subversion repositories under /var/svnroot.
#
$ sudo mkdir -p /var/svnroot/projects
$ sudo chown www-data:www-data -R /var/svnroot
$ sudo chmod 770 -R /var/svnroot
$ sudo svnadmin create /var/svnroot/projects

Next we need to configure apache, so edit the file /etc/apache2/mods-available/dav_svn.conf, here are some of the basic things you need to set.

...
# Uncomment this to enable the repository
DAV svn
---
# no anonymous access.
Satisfy Any
Require valid-user
---
# path to repo's.
SVNParentPath /var/svnroot
.....
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
...

Now we need to setup a user with htpasswd and restart apache.

# provide a password when asked.
#
$ htpasswd -c /etc/apache2/dav_svn.passwd tester

# restart apache and after creating a new repository.
#
$ sudo /etc/init.d/apache2 reload

To setup a project, I just dumped and loaded from an existing project as follows.

# at existing project site we dump the repository (called 'projects').
#
$ sudo svnadmin dump /var/svnroot/projects > projects.dump

# move that to your newly setup subversion location and load.
#
$ scp remotehost:/path-to-dump/projects.dump .
$ sudo svnadmin load /var/svnroot/projects < projects.dump

# open url: http://hostname/svnroot/projects
# and supply user 'tester' and your password  should 
# allow you to browse the repo.

All comments are welcome, please post if you have any questions!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.