Moving a Subversion repository

Posted by & filed under Odds.

Host a subversion SNV repository using svnserve server

I am detailing here how I moved an svn repos off my Windows development machine onto a Linux based webserver, making it available for checkout from there.

Subversion was previously installed on both my windows machine and my linux box.

Backup old and create new repos

Backup old repos from a command prompt:
$ svnadmin dump c:\your_svn_dir\repos > c:\your_svn_dir\repos.bak (will take relative path from cmd)

Create a new repos on destination machine:
$ svnadmin create /home/user/svn_directory/repos

Edit the svnserve config file

Tip: Make sure no leading spaces are on the uncommended lines!

Here’s an example to give read-only access, and requiring a username and password:

$ pico /home/user/svn_directory/repos/conf/svnserve.conf

anon-access = none
auth-access = read
password-db = passwd (path to password file, relative to self)
realm = My Repos Realm (authentication realm of the repository. Two repositories using the same password-db should have the same realm.)

Now edit the password file to add username and password:

$ pico /home/user/svn_directory/repos/conf/passwd

user = password

Load the backup into your new repos

Copy the repos.bak file onto your linux box. Now you can load your backup into the new repos:

$ svnadmin load /home/user/svn_directory/repos < /home/user/svn_directory/repos.bak

Start svnserve server

$ svnserve -d -r /home/user/svn_directory

-d option for daemon mode
-r option is the root directory to serve from

There are various ways of starting the server, see section 4 at the following page for details:

Install svn as a service (if desired)

Following a reboot of the machine the svnserve daemon would require starting again. However you can have it start automatically as an xinetd service. Type this command at a bash prompt:

cat >> /etc/xinetd.d/svn << “EOF”
# Begin /etc/xinetd.d/svn

service svn
port                    = 3690
socket_type             = stream
protocol                = tcp
wait                    = no
user                    = svn
server                  = /usr/bin/svnserve
server_args             = -i -r /path/to/repositories

# End /etc/xinetd.d/svn

If you find this does not work, check that for the following lines in /etc/services:

svn 3690/tcp # Subversion
svn 3690/udp # Subversion

Test checkout

You can now checkout the repos from the following location using the checkout command: svn://

Points to note

After making changes to config file you have to restart svnserve:

$ killall svnserve
$ svnserve -d -r /home/user/svn_directory


Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>