Tag Archives: subversion

To backup your svn repository, you just type below command:

svnadmin dump [REPO_PATH] > [DUMP_FILE_PATH]

Replace [REPO_PATH] with your repository path and [DUMP_FILE_PATH] with your dump file path in your machine.

To backup only your latest revision, first you need to find out the latest revision number from your repository. To do that just run below command:

svnadmin verify [REPO_PATH]

It will list out the revision number and the most bottom will be your latest revision number. That will be referenced by [LATEST_REVISION_NUM] from now on. Run below command to backup only the latest revision from [REPO_PATH].

Then run below command to backup the latest revision from your repository:

svnadmin dump -r [LATEST_REVISION_NUM] [REPO_PATH] > [DUMP_FILE_PATH]

To restore your repository from a dump file, run following command:

svnadmin load [REPO_PATH] < [DUMP_FILE_PATH]

Related softwares:

  1. Ubuntu 9.04
  2. Subversion 1.6.x
  3. Apache2

First, if you haven’t install Apache2 and Apache2-Subversion-library, you can do so by typing below:

sudo apt-get install apache2 apache2lib-svn

Then, edit the apache2-svn file in /etc/apache2/mods-available/dav_svn.conf.
Enter the following entry into the file and replace the variables with the square-bracket [xxx] with your value accordingly.

<Location [SVN_URL_PATH]>
DAV svn
SVNParentPath [SVN_PARENT_PATH]
AuthName "[SVN_REPOSITORY_NAME]"
AuthUserFile [AUTHENTICATION_FILE_PATH]
Require valid-user
</Location>

If you wish to have the repository URL such as http://hostname/svn, then replace the [SVN_URL_PATH] with /svn. Replaced the [SVN_PARENT_PATH] with the parent path of your Subversion repository. If you place your repository named projects in /var/www/svn_root/projects, then replace it with /var/www/svn_root. Replace the [SVN_REPOSITORY_NAME] with any name that you wish. Lastly, replace [AUTHENTICATION_FILE_PATH] with the absolute path of your authentication file, which we will create later. Let say we will create the file in /var/www/svn_root which named mypasswd. Then replace it with /var/www/svn_root/mypasswd.

To create the authentication file with a user named dhydrated, type the following:

htpasswd -c /var/www/svn_root/mypasswd dhydrated

To modify existing authentication file with a user named dhydrated, type the following:

htpasswd -m /var/www/svn_root/mypasswd dhydrated

Restart your Apache2 server by typing:

sudo /etc/init.d/apache2 restart

If everything went well, you should be able to access your repository via http://hostname/svn/projects, and a dialog box will be prompted to ask for your username and password as you put in the authentication file.

As the time of writing, I’m using Ubuntu 9.04 (Jaunty) and Subversion 1.6.

At the moment, Ubuntu package only provides Subversion up to version 1.5.x. To get the latest Subversion 1.6.x, you need to tweak a bit your sources.list. This will get the Subversion 1.6 from Personal Package Archive (PPA).

echo
'deb http://ppa.launchpad.net/anders-kaseorg/subversion-1.6/ubuntu
jaunty main' >> /etc/apt/sources.list

If you don’t have the permission to do so, you have to change to the root user by typing the command below:

sudo -i

After finished with editing the sources.list, exit the root user and go back to your normal user by typing below:

exit

Then you need to authenticate the above PPA, by typing below.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 413576CB

Then update your package list:

sudo apt-get update

Then you can start installing Subversion 1.6:

sudo apt-get install subversion

After finished installing, check your Subversion version by typing below:

svn --version