Thursday, May 16, 2013

svn installation on linux


Subversion is an universally recognized and adopted open-source centralized version control system and is used in the development of many software projects.

Here I will explain the installation procedures for the latest subversion software and some configuration related to it along with the installation of web based subversion administration interface.
                                                                                                   
I am going to explain the two methods of subversion installation on a fresh ubuntu server.

First method is the stock installation from ubuntu repository,

Install Subversion, Apache and Subversion server modules for Apache by issuing the below commands,

apt-get install apache2 libapache2-svn subversion

Thats it !!

But I prefer the installing from source, ( Method Two )



Install the dependencies,

 apt-get update
 apt-get install tzdata libexpat1-dev libapr1-dev libaprutil1-dev pkg-config apache2-prefork-dev libapache2-svn apache2

Apache Portable Runtime are required for accessing repositories via web protocols that is http:// https:// with neon support,

neon is an HTTP and WebDAV client library, with a C interface. We need to download and install neon from the link below,

wget http://www.webdav.org/neon/neon-0.29.6.tar.gz
tar -zxvf neon-0.29.6.tar.gz
cd neon-0.29
./configure
make && make install

Now we can start installing subversion, download latest package from this link http://www.carfab.com/apachesoftware/subversion/subversion-1.7.9.tar.gz

tar -zxvf subversion-1.7.9.tar.gz
cd subversion-1.7.9
./configure --with-apr=/usr/bin/apr-1-config --with-apr-util=/usr/bin/apu-1-config --with-neon=/usr/local/
make && make install

This will install the latest subversion on your machine, You can check it by issuing the below command,

svn --version
svn, version 1.7.9 (r1462340)

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

Check Subversion server modules for Apache,

apachectl -M

 dav_module (shared)
 dav_svn_module (shared)
 authz_svn_module (shared)


 Comment out the entries in /etc/apache2/mods-enabled/dav_svn.conf file, we can use apache virtual host file for adding those parameters.

 Now we can install a web based subversion administration interface. For that I choose svn access manager.

 Install the dependencies,

 apt-get install mysql-server php5 libapache2-mod-php5 php5-mysql

 Download it from this source, http://ncu.dl.sourceforge.net/project/svn-access-mana/svn-access-manager/0.5.5.22/svn_access_manager-0.5.5.22.zip

 unzip it, rename it to access and move it to your apache document root. /var/www/html/ in my case,

 chown apache.apache /var/www/html/access -R

 My virtual host file,

 DocumentRoot /var/www/html/
 Alias /svnstyle /var/www/html/access
 <Directory "/var/www/html/access">
    Options +SymLinksIfOwnerMatch
    AllowOverride All
    Order allow,deny
    Allow from all
 </Directory>

 <Location /svn>
  DAV svn
  SVNParentPath /var/lib/repo
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav.passwd
  AuthzSVNAccessFile /etc/apache2/dav.authz
  Require valid-user
  SVNIndexXSLT /svnstyle/svnindex.xsl
 </Location>

 Where /var/lib/repo is my repositories holding directory.
       /etc/apache2/dav.passwd user file.
  /etc/apache2/dav.authz svn access file.

  chown apache.apache /var/lib/repo /etc/apache2 -R

  Now trigger this url http://<hostname>/access/install in your browser and follow the steps to install.

 Note: Admin passwd should be 14 character with small,caps,num,symbols.

 After installation go for http://<hostname>/access,

 create users , repository, project, give access rights and finally create access file.

 Example user and access file,

 cat /etc/apache2/dav.passwd
 admin:$1$f72982ad$bBzkp3BGhuiHCROc19fGQ1
 user1:$1$05b819cd$gEJybiurjmXEWO.z4bmBI/
 user2:$1$a4d30094$3D2tLcTxux9qmoHo9NjKw/
 user3:$1$86e06758$81irxd8FdZaZN4OWjdRSc.

 cat /etc/apache2/dav.authz
 [/]
 admin = r

 [firstrepo:/]
 user1 = rw
 user2 = r

 [secondrepo:/project1]
 user1 = r

 [secondrepo:/project2]
 user2 = rw
 user3 = r

 Now use any client, I use TortoiseSVN for check out, commits etc  to appropriate authenticated repos and projects.

 Thanks for reading ..

 Cheers /-

   





No comments:

Post a Comment