Friday, 19 June 2015

Subversion (svn)

  • Subversion is a popular open-source version control tool. 

Version Control System (VCS) 

  •  VCS is a software that helps software developers to work together and maintain a complete history of their work.
  • Goals of version control system 
    • Allow developers to work simultaneously
    • Do not overwrite each other's changes.
    • Maintain history of every version of everything.
  • A VCS is divided into two categories
    • Centralized Version Control System (CVCS)
    • Distributed Version Control System (DVCS)
  • Subversion falls under CVCS, meaning that it uses central server to store all files and enables team collaboration.

SVN Installation on CentOS 6/ RHEL 6/ Fedora

    Run the following commands as 'root' or,

#sudo yum install subversion mod_dav_svn

                    OR

#sudo wget http://apache.cs.utah.edu/subversion/subversion-1.6.11.tar.gz  % downloading subversion from source

#sudo yum install mod_dav_svn                      %installing                   

#cd /var/www/                                                   %changing directory

#sudo tar -xvzf subversion-1.6.11.tar.gz        %extracting

#sudo mv subversion-1.6.11 subversion        %renaming

#sudo vim /etc/httpd/conf.d/subversion.conf   %opening configuration file for editing

LoadModule dav_svn_module     modules/mod_dav_svn.so
LoadModule authz_svn_module   modules/mod_authz_svn.so
<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   # Limit write permission to list of valid users.
   <LimitExcept GET PROPFIND OPTIONS REPORT>
      # Require SSL connection for password protection.
      # SSLRequireSSL
      AuthType Basic
      AuthName "Subversion repositories"
      AuthUserFile /etc/svn-auth-users
      Require valid-user
   </LimitExcept>
</Location>

User Setup

%Creating user tonym
#htpasswd -cm /etc/svn-auth-users tonym
New password:
Re-type new password:
Adding password for user tonym
Note: Use exactly same file and path name as used on subversion.conf file. This example use /etc/svn-auth-users file.
  

Create and configure svn repository 


#mkdir /var/www/svn
#cd /var/www/svn
#svnadmin create testrepo
#chown -R apache.apache testrepo
%% If you have SELinux enabled (you can check it with "sestatus" command)
 %% 
then change SELinux security context with chcon command %%
#chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
%%Following enables commits over http%%
#chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo

Restart Apache

#sudo service httpd restart

Configure Repository

To disable anonymous access and enable access control add following rows to /var/www/svn/testrepo/conf/svnserve.conf file:

%% Disable anonymous access %%
anon-access = none
%% Enable access control %%
authz-db = authz

Create trunk,tags & branches directory structure under the testrepo repository

#mkdir -p /tmp/svn-structure-template/ {trunk,branches,tags}

Then import template to project repository using “svn import” command:


#svn import -m 'Initial import' /tmp/svn-structure-template/ http://localhost/svn/testrepo/
Adding         /tmp/svn-structure-template/trunk
Adding         /tmp/svn-structure-template/branches
Adding         /tmp/svn-structure-template/tags
Committed revision 1.
Check results on browser and see testrepo revision 1:

http://myserverip/svn/testrepo/ 

No comments:

Post a Comment