SubVersion
From Oxxus Wiki
Contents |
Overview
This service is a successor of widely known CVS, now abandoned, as SVN offers more features within, with better overall performances as well as user friendlier interface. It also offers several services integration with Apache, Perl or plain SSH. Using all these service, SVN repositories can be accessed in order to maintain existing sources or updated with new one. Both ways are available, so you can update your local software version as well as update with new one at server side for later use. Communication with SVN repositories are strictly defined with account's related rules, so every user that has access to repositories has its own permissions defined by administrative user who maintains SVM repositories or SVN server itself.
Installation
Service can either be installed using package installers like yum at RedHat/Fedora/Centos systems, apt-get or aptitude at Debian/Ubuntu ones. It is also available as source for building at certain systems. If installed via package installers, all required dependencies will automatically be downloaded and installed, so SVN can be started without any problems.
[root@svn /]# yum -y install subversion
Loaded plugins: fastestmirror
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package subversion.i686 0:1.6.11-2.el6_0.3 set to be updated
--> Processing Dependency: perl(URI) >= 1.17 for package: subversion-1.6.11-2.el6_0.3.i686
--> Processing Dependency: libneon.so.27 for package: subversion-1.6.11-2.el6_0.3.i686
--> Running transaction check
---> Package neon.i686 0:0.29.3-1.2.el6 set to be updated
--> Processing Dependency: libproxy.so.0 for package: neon-0.29.3-1.2.el6.i686
--> Processing Dependency: libpakchois.so.0 for package: neon-0.29.3-1.2.el6.i686
---> Package perl-URI.noarch 0:1.40-2.el6 set to be updated
--> Running transaction check
---> Package libproxy.i686 0:0.3.0-2.el6 set to be updated
--> Processing Dependency: libproxy-bin = 0.3.0-2.el6 for package: libproxy-0.3.0-2.el6.i686
--> Processing Dependency: libproxy-python = 0.3.0-2.el6 for package: libproxy-0.3.0-2.el6.i686
---> Package pakchois.i686 0:0.4-3.2.el6 set to be updated
--> Running transaction check
---> Package libproxy-bin.i686 0:0.3.0-2.el6 set to be updated
---> Package libproxy-python.i686 0:0.3.0-2.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
Package Arch Version Repository Size
Installing:
subversion i686 1.6.11-2.el6_0.3
Installing for dependencies:
libproxy i686 0.3.0-2.el6 libproxy-bin i686 0.3.0-2.el6 libproxy-python i686 0.3.0-2.el6 neon i686 0.29.3-1.2.el6 pakchois i686 0.4-3.2.el6 perl-URI noarch 1.40-2.el6
Transaction Summary
Install 7 Package(s) Upgrade 0 Package(s)
Total download size: 2.5 M
Installed size: 12 M
Downloading Packages:
(1/7): libproxy-0.3.0-2.el6.i686.rpm
(2/7): libproxy-bin-0.3.0-2.el6.i686.rpm
(3/7): libproxy-python-0.3.0-2.el6.i686.rpm
(4/7): neon-0.29.3-1.2.el6.i686.rpm
(5/7): pakchois-0.4-3.2.el6.i686.rpm
(6/7): perl-URI-1.40-2.el6.noarch.rpm
(7/7): subversion-1.6.11-2.el6_0.3.i686.rpm
Total 2.5 MB/s | 2.5 MB 00:01 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction
Installing : perl-URI-1.40-2.el6.noarch Installing : libproxy-python-0.3.0-2.el6.i686 Installing : libproxy-bin-0.3.0-2.el6.i686 Installing : libproxy-0.3.0-2.el6.i686 Installing : pakchois-0.4-3.2.el6.i686 Installing : neon-0.29.3-1.2.el6.i686 Installing : subversion-1.6.11-2.el6_0.3.i686
Installed:
subversion.i686 0:1.6.11-2.el6_0.3
Dependency Installed: libproxy.i686 0:0.3.0-2.el6 libproxy-bin.i686 0:0.3.0-2.el6 libproxy-python.i686 0:0.3.0-2.el6 neon.i686 0:0.29.3-1.2.el6 pakchois.i686 0:0.4-3.2.el6 perl-URI.noarch 0:1.40-2.el6
Complete! [root@svn /]#
Once installation process ends, and is complete, SVN service is available and needs configuration.
Configuration
Unfortunately, installation process does not provide configurations so SVN service has to be set up with SVN related commands. First subversion user has to be added, for example svn :
[root@svn /]# useradd svn
[root@svn /]# passwd svn
Once user is created and password assigned, subversion repositories folders has to be created.
[root@svn /]# su svn (this will chroot under svn user home folder)
[svn@svn ~]$ mkdir repositories (creates repositories folder named repositories)
[svn@svn ~]$ cd repositories
[svn@svn repositories]$ svnadmin create myproject (creates svn project repository)
[svn@svn repositories]$ cd myproject
[svn@svn myproject]$ ls -all
total 32
drwxrwxr-x 6 svn svn 4096 Oct 12 12:37 .
drwxrwxr-x 3 svn svn 4096 Oct 12 12:37 ..
drwxrwxr-x 2 svn svn 4096 Oct 12 12:37 conf
drwxrwsr-x 6 svn svn 4096 Oct 12 12:37 db
-r--r--r-- 1 svn svn 2 Oct 12 12:37 format
drwxrwxr-x 2 svn svn 4096 Oct 12 12:37 hooks
drwxrwxr-x 2 svn svn 4096 Oct 12 12:37 locks
-rw-rw-r-- 1 svn svn 229 Oct 12 12:37 README.txt
These are start-up, initial files created upon SVN project initialization.
Correct permissions over new repositories have to be set at file svnserve.conf within file /conf subfolder.
auth-access = write (allows writing/updating repositories to authenticated user)
password-db = passwd (fetch passwords for user authentication from file passwd)
Passwords for all user that can access this repositories are set at file passwd in format username = password, for i.e. test = mytest
Save file after editing it for later use.
Finally start up SVN services with command svnserve -d -r /home/svn/repositories
Using subversion
Most used SVN actions are import (imports svn repositories structure), svn commit (ci)(commits the changes back into the database) and svn checkout (co) (to work on repositories). Once repository is created, it is ready for use. Only users defined at svnserve.conf will have access to repository according to the rules set in configuration file. There are several ways of accessing and working with sources at SVN repositories, via browsers to Apache web server that communicates with SVN server, via SSH or using dedicated client applications. Whichever option is used, the result will be always the same. Sources, offered from SVN server host within repositories, will be available at local systems to work on them. If enough permissions are granted, SVN repositories could be updated at the SVN server host.