SWAT Blog

Posts Tagged ‘subversion’

Move a Subversion Repository from One Remote Server to Another

Tuesday, December 28th, 2010

The servers were in remote locations and all I had was ssh access.

Step One: Back up your old repository
This is done with the svnadmin command.

svnadmin dump /srv/svn/repository_name > reponame.dmp

Step Two: Create the new Repository on new svn server
This is same as creating a new project on your svn server

svnadmin create /srv/svn/repository_name

Step Three: Transfer the old Repository dump on your new svn server
You can do this by any way you want. I choose scp.

scp reponame.dmp root@remote-server:/opt/new_repo_name

Last Step: Import your old repository into the new one

root@server:~#cd /opt
root@server:/opt#svnadmin load /srv/svn/new_repository_name < reponame.dmp

It’s very simple. My .dmp file was about 2GB so it took hours to transfer. But if you have physical access to the servers this could be a few minutes job.

Install SVN SERVER (subversion) on CENTOS 5

Thursday, December 9th, 2010

Prerequisites

  • Fresh installation of CentOS 5.
  • Make sure you should login as root.
  • Make sure you should have apache2 installed (httpd).

Installation Steps
First we’ll install Apache configuration directives for serving Subversion repositories through Apache HTTP Server.

[root@linux10 ~]#yum install subversion mod_dav_svn

Instruct Apache to load the mod_dav_svn module using the LoadModule directive by editing http.conf file

[root@linux10 ~]#vi /etc/httpd/conf/httpd.conf

If the following two lines are not present, add them:

LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so

Create a directory where all svn repositories will be located:

[root@linux10 ~]#mkdir /srv/svn

Create your first Repository

[root@linux10 ~]#svnadmin create --fs-type fsfs /srv/svn/your_project_name

Set the correct file permissions for apache.

[root@linux10 ~]#chown -R apache.apache /srv/svn/your_project_name

Tell Apache where to find the new repository. Here we create an additional Apache configuration file specifically for the repositories.

[root@linux10 ~]#vi /etc/httpd/conf.d/subversion.conf

Add the following directive in the subversion.conf file

DAV svn
SVNPath /srv/svn/your_project_name
AuthType Basic
AuthName "your_project_name Repository"
AuthzSVNAccessFile /srv/svn/svn-acl-conf
AuthUserFile /srv/svn/your_project_name.htpasswd
Require valid-user

Add a repository user

[root@linux10 ~]#touch /srv/svn/your_project_name.htpasswd
[root@linux10 ~]#htpasswd -m /srv/svn/your_project_name.htpasswd  username

Create the Access Control List for the SVN Repository

[root@linux10 ~]#vi /srv/svn/svn-acl-conf

Add the following directives in the file. Where username represents the username of the repository user you created earlier.

[your_project_name:/]
username = rw

Final step, restart Apache server.

[root@linux10 ~]#service httpd restart

After browsing your project, if you gets the below message that means you have done it successfully.

http://localhost/svn/your_project_name

Revision 0: /
Powered by Subversion version 1.4.2 (r22196).

  • © 2004-2015 Special Work & Technology Limited