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:
http://www.linuxfromscratch.org/blfs/view/svn/server/svnserver.html

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
EOF

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://example.com/repos

Points to note

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

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

Sources/credits:
http://queens.db.toronto.edu/~nilesh/linux/subversion-howto
http://linuxcommand.org/man_pages/svnserve8.html
http://csoft.net/docs/svnserve.html
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-serversetup-svnserve.html
http://svnbook.red-bean.com/en/1.0/ch06s03.html
http://www.botsko.net/blog/2007/03/12/installing-subversion-on-centos

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>

Bitnami