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/subversion.nestorurquiza.com
$ sudo addgroup svn
$ sudo usermod -a -G svn www-data
$ sudo usermod -a -G svn admin
$ sudo chmod 2770 /var/local/svn/subversion.nestorurquiza.com
$ sudo svnadmin create /var/local/svn/subversion.nestorurquiza.com
$ sudo vi /var/local/svn/subversion.nestorurquiza.com/conf/authz #ACL
$ sudo mkdir /var/log/apache2/subversion.nestorurquiza.com
$ sudo vi /etc/apache2/sites-available/subversion
<VirtualHost *>

 ServerName svn.nestorurquiza.com
 ServerAlias subversion.nestorurquiza.com
 DocumentRoot /var/local/svn/subversion.nestorurquiza.com

 <Location /repos/reporting>
   DAV svn
   SVNListParentPath off
   AuthType Basic
   AuthName "Subversion repository"
   SVNPath /var/local/svn/subversion.nestorurquiza.com
   AuthzSVNAccessFile /var/local/svn/subversion.nestorurquiza.com/conf/authz
   AuthUserFile /var/local/svn/subversion.nestorurquiza.com/conf/passwd
   Require valid-user
   <LimitExcept GET PROPFIND OPTIONS REPORT>
        Require valid-user
   </LimitExcept>
 </Location>

 <Directory "/var/local/svn/subversion.nestorurquiza.com">
   Options -Indexes
 </Directory>
</VirtualHost>
$ sudo cp authz /var/local/svn/subversion.nestorurquiza.com/conf/authz #assuming there is an existing svn access file. Better keep it on SVN ;-)
$ sudo cp passwd /var/local/svn/subversion.nestorurquiza.com/conf #assuming there is an existing password file. Better keep it on SVN ;-)
$ sudo htpasswd /var/local/svn/subversion.nestorurquiza.com/conf/passwd "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/subversion.nestorurquiza.com < ~/file_from_command_svnadmin_dump_originalRepoPath
$ sudo chown -R www-data:svn /var/local/svn/subversion.nestorurquiza.com
$ sudo chmod -R g+w /var/local/svn/subversion.nestorurquiza.com
$ sudo /etc/init.d/apache2 restart

No comments:

Followers