Using Subversion for Collaborative Development FreeBSD

General Information

Subversion (SVN) is an alternative to using Concurrent Version System (CVS) for collaborative development, though it has other uses if you develop on more than one machine and wish to keep all your work in a central location. chaussures nike air max adidas ace This guide will show you how to setup Subversion with Webaccess via the Apache2 mod_dav svn module. chausson ugg chaussure asics If you already use apache 1.3 you can continue to use that, just change the port that apache2 listens on in its httpd.conf file.

Subversion Book is an excellent resource for information outside the scope of this guide.

Requirements

  1. Local root access on the box or be able to su to root.
  2. A SSH client such as puTTy or SecureCRT (if you are setting it up remotely).
  3. A plain text editor, I prefer nano

Installation

We have to start out by building apache2. air jordan future nike air max 90 femme nike internationalist Because we are building it with the intention of using Subversion with it, we must build it with Berkeley DB (sleepycat) support, as the Subversion filesystem is actually built as a sleepycat database. adidas football nike roshe run 2017 new balance new balance pas cher It is this that allows for the versioning of files.

 # cd /usr/ports/www/apache2 # make install WITH_BERKELEYDB=db42 

We make sure that the apache2 aprutil library is known, this file sometimes seems to get “lost”

 # ldconfig -m /usr/local/lib/apache2/ # echo "/usr/local/lib/apache2" >> /etc/ld.so.conf # echo "/usr/local/lib/apache2" >> /etc/ld-elf.so.conf 

Instruct the Operating System to run apache2 at startup

 # echo 'apache2_enable="YES"' >> /etc/rc.conf 

Now to build Subversion

 # cd /usr/ports/devel/subversion # make install -DWITH_MOD_DAV_SVN 


Configuration

OK, subversion and apache with berkeley db support are now compiled and installed. chaussure adidas You have a choice of either creating a single huge repository for all of your projects, or individual repositories for each. I will detail each now.

General Setup

Create Subversion Home folder

 # mkdir -p /usr/home/svn 

Create a generic repository format

 # mkdir -p /usr/home/svn/default/trunk # mkdir /usr/home/svn/default/branches # mkdir /usr/home/svn/default/tags 

Copy some files will need for the web interface

 # cp /usr/ports/devel/subversion/work/subversion-1.0.6/tools/xslt/* /usr/local/www/data-dist/ 

Note: The path to the tools/xslt will change with versions of subversion so change the subversion-1.0.6 to whatever it is for your version of subversion, ie subversion-1.0.7 or subversion-1.0.8 and so on.

Setup Blanket Access: If you wish to enable htaccess style password login to the subversion repository then use this system. nike huarache nike dynamo This is the basic access control system, which can be extended to enable per directory access control as well.

 # mkdir /usr/home/svn/access # touch /usr/home/svn/access/users 

Create the users using the htpasswd utility

 # htpasswd -mb /usr/home/svn/access/users username password 

Configuring Apache2 for Blanket Access control

 # nano -w /usr/local/etc/apache2/httpd.conf 

Add the following to the httpd.conf file, this can be at the bottom or wherever, it will create a http://www.myservername.com/svn/ URL which you can then access

 ## SVN WebDAV Repository Setup  DAV svn SVNParentPath /usr/home/svn/repos SVNIndexXSLT "http://www.myservername.com/svnindex.xsl" # anonymous first Satisfy Any Require valid-user # authenticating them valid ones AuthType Basic AuthName "Subversion Repositories" AuthUserFile /usr/home/svn/access/users  

This can also be placed inside a virtual host directive

Extending the Blanket Access control to enable Per-Directory Access control

 # touch /usr/home/svn/access/control 

If you are going to use a single large repository with all your projects in and you wish to allow and deny some users access to certain parts of the repository, then you can setup the control file like this. soldes timberland air jordan 11 adidas superstar 2 soldes nike air max 90 femme 2017 In this example I will use users with the names of admin, manager (a project manager), commiter, client. chaussures nike femme 2017 basket adidas zx flux The access rules are inheritted, but I will demonstrate how to override an inheritted value. new balance baskets If someone is not mentioned at all within the tree, then they are denied access.

 [/] admin = rw manager = r [/bigproject] manager = rw commiter = r [/bigproject/trunk] commiter = rw client = r [/bigproject/branches] client = r [/bigproject/trunk/manager_notes] client = commiter = 

In this file from the very start the admin has full rights to the whole repository, and the manager can read and see all of the projects, but he has full access to the whole of the bigproject folder and the commiter can read the whole of the bigproject folder, all the development is to be kept in trunk so the commiter has full access to that, and the clients might want to be able to get the latest builds of a project, so they can read it. timberland roll top pas cher nike free trainer They might also want access to the stable branches, so they are allowed read access to that. nike free trainer nike air max flyknit Finally, the project manager has some project notes which he doesn’t want anyone else to gain access to, so the client and commiter are set to empty permissions which denys them access to that folder. nike x fragment You can also specify general access rights for all by using the ‘*’ and assigning access rights to that.

Now the same again, but using per directory access control on a multiple repository system

 [bigproject:/] admin = rw manager = rw commiter = r [bigproject:/trunk] commiter = rw client = r [bigproject:/branches] client = r [bigproject:/trunk/manager_notes] client = commiter = 

Edit the apache2 config file to use per-directory access control. adidas chaussures pas cher nike air max thea Find the Blanket Access control Location area and add the below lines just underneath the SVNIndexXSLT

 # If we are using the Per-Directory Access Control then we leave this uncommented # Access Control AuthzSVNAccessFile /usr/home/svn/access/control 

It should look like this

 ## SVN WebDAV Repository Setup  DAV svn SVNParentPath /usr/home/svn/repos SVNIndexXSLT "http://www.myservername.com/svnindex.xsl" # If we are using the Per-Directory Access Control then we leave this uncommented # Access Control AuthzSVNAccessFile /usr/home/svn/access/control # anonymous first Satisfy Any Require valid-user # authenticating them valid ones AuthType Basic AuthName "Subversion Repositories" AuthUserFile /usr/home/svn/access/users  
 

Building a Single General Repository

Create our single main repository

 # svnadmin create /usr/home/svn/repos # svn import /usr/home/svn/default file:///usr/home/svn/repos -m "initial import" 

Should you later want to divide this repository into project folders, you will need to checkout the whole repository and use the svn move, svn copy and so on commands, which can be found in the Subversion Book

Building a Multiple Project Repository

Make a new repository

 # mkdir /usr/home/svn/repos # svnadmin create /usr/home/svn/repos/projectname # svn import /usr/home/svn/default file:///usr/home/svn/repos/projectname -m "Initial Import" 

Final Setup

Make sure that apache can read the svn repositories

 # chown -R www:www /usr/home/svn 

and make the access control and userlist readable only by apache. nike chaussure new balance running nike flyknit lunar All the contents are pretty much encrypted, but you don't want other shell users peeking at them, though they could get through via a php script, but this is the best way to go about it.

 # chmod 600 /usr/home/svn/access/control # chmod 600 /usr/home/svn/access/users 

There, you now have a fully working Subversion Repository. ugg australia To checkout the contents of the trunk of a project in your repository via the command line tool

 # svn checkout http://www.mydomain.com/svn/projectname/trunk projectname 

this will make a folder called "projectname" in the current folder you are in when you run the command.

Once you have made changes to a project you can commit those changes by changing into the project folder then

 # svn commit -m "Notes regarding the changes" 

And finally to update your copy of the code from the repository, change into the project folder then

 # svn update 

These commands are all for the SVN Command line tool, which is installed as part of the devel/subversion port. nike pas cher 2017 ugg homme If you wish to use the command line tool and not create the files needed for running a repository with apache2, then use

 # cd /usr/ports/devel/subversion # make install clean 

and skip the remaining steps.

There is also a range of clients.

Speak Your Mind

*