The below describes creating a SVN repository from a CentOS Linux shell followed by importing a SVN repository dump into the newly created repository. This can be useful for many reasons including moving servers or even just moving the location of an SVN repo.
If you don’t have subversion installed go ahead and do so now. The below command can be issued from the shell of a CentOS Linux server using yum to install subversion.
Install Subversion with YUM:
- yum install subversion
Create SVN Repository:
First we will create a SVN repository using the below syntax. The svnadmin command, which is a utility installed with the subversion package, is used to create the new repo. Make sure to put some thought into location of your repositories as you will want to secure it so if there is going to be more than one repo then you might want to create a directory for all of the repos to be stored in.
- svnadmin create repo-name
Import SVN Repo Dump:
Now import the SVN repository dump that you have moved over to the new server location. For the below example we will pretend that the new repository is called repo-name and the old repo dump is old-repo.gz.
First unzip the SVN dump.
- gzip -d old-repo.gz
This will leave you with a file named old-repo. Use the below syntax to import the SVN dump into the new repository we just created.
svnadmin load repo-name < old-repo
Now the old repository's data has been imported into the newly created SVN repo. Make sure to configure access to the new repository by modifying repo-name/conf/svnserve.conf. I would suggest adding SASL encryption to make things as secure as possible if you are going to serve the repo via SVN and not HTTPS.