Friday, September 02, 2011

Upgrading subversion

We are using WebDAV with Apache for subversion. Below are the steps I followed to migrate an old subversion repository to a brand new Ubuntu server with latest subversion.

Note that "admin" is a user which can make administer subversion.

$ sudo apt-get install subversion libapache2-svn
$ sudo mkdir -p /var/local/svn/
$ sudo addgroup svn
$ sudo usermod -a -G svn www-data
$ sudo usermod -a -G svn admin
$ sudo chmod 2770 /var/local/svn/
$ sudo svnadmin create /var/local/svn/
$ sudo vi /var/local/svn/ #ACL
$ sudo mkdir /var/log/apache2/
$ sudo vi /etc/apache2/sites-available/subversion
<VirtualHost *>

 DocumentRoot /var/local/svn/

 <Location /repos/reporting>
   DAV svn
   SVNListParentPath off
   AuthType Basic
   AuthName "Subversion repository"
   SVNPath /var/local/svn/
   AuthzSVNAccessFile /var/local/svn/
   AuthUserFile /var/local/svn/
   Require valid-user
        Require valid-user

 <Directory "/var/local/svn/">
   Options -Indexes
$ sudo cp authz /var/local/svn/ #assuming there is an existing svn access file. Better keep it on SVN ;-)
$ sudo cp passwd /var/local/svn/ #assuming there is an existing password file. Better keep it on SVN ;-)
$ sudo htpasswd /var/local/svn/ "new username here" #to create individual users
$ sudo ln -s /etc/apache2/sites-available/subversion /etc/apache2/sites-enabled/004-subversion
$ sudo svnadmin load /var/local/svn/ < ~/file_from_command_svnadmin_dump_originalRepoPath
$ sudo chown -R www-data:svn /var/local/svn/
$ sudo chmod -R g+w /var/local/svn/
$ sudo /etc/init.d/apache2 restart

No comments: