Subversion in nutshell


subversion

A widely used open source version control system. Subversion manages both files and directories with changes made to them over a period or time. This is a sort of “TIME MACHINE”.

Subversion works across networks, So people on different computers can use it. Same set of data can be managed and modified from different locations. Progress occur more quickly without a single conduit through which all modification must happen. Any time you can change, add or delete folder or file that you manage with subversion. All the work are versioned, Any time you can go-back, look at and get the contents of previous revisions.

Setup Subversion

Prerequisite
Ubuntu server (LTS 16.04)
Apache 2.0

Install Apache


sudo apt-get update
sudo apt-get install apache2

Install Subversion
Below command install Subversion packages along with the dependencies


sudo apt-get install subversion libapache2-mod-svn libapache2-svn libsvn-dev
sudo a2enmod dav
sudo a2enmod dav_svn
sudo service apache2 restart

Configure Apache for Subversion

Once the above packages are installed, Apache subversion module create a configuration file @ /etc/apache2/mods-enabled/dav_svn.conf. Edit the file with below configurations


DAV svn
SVNParentPath /var/lib/svn

AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
AuthzSVNAccessFile /etc/apache2/dav_svn.authz

 

Creating subversion Repository

With below command we can create the repository with name “mysvnrepo”


sudo mkdir -p /var/lib/svn/
sudo svnadmin create /var/lib/svn/mysvnrepo

Changing ownership and permissions of repo


sudo chown -R www-data:www-data /var/lib/svn
sudo chmod -R 775 /var/lib/svn

Creating Users for SVN

First time (or first user) you need to use the below command


sudo htpasswd -cm /etc/apache2/dav_svn.passwd admin

Additional users


sudo htpasswd -m /etc/apache2/dav_svn.passwd user1
sudo htpasswd -m /etc/apache2/dav_svn.passwd user2

Access Control for Subversion with Apache2 and Authz

You can create a file with vim editor “dav_svn.authz” and insert the below details


[groups]
all = admin,user1,user2

[mysvnrepo:/]
admin = rw
user1 = rw
user2 = r

Permissions

There are only two types of permission:

Read only – r – a user can check-out a copy of a project.
Read and Write – rw – a user can check-out and commit changes to a project.

Backup and Restore of SVN
Using svnadmin you can create dumps and restore to any new server

Backup your old Repository
You can move to a new SVN server after taking a backup dump with following commands


svnadmin dump /path/to/repository > repo_name.svn_dump

Restore SVN dumps
Import your old repository into the new one with below commands


svnadmin load /path/to/repository < repo_name.svn_dump

Access SVN repository in browser

You can access your repo with server IP/svn/repo-name

example : http://192.168.100.100/svn/mysvnrepo

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: