Sunday, June 10, 2012

Creating a subversion server in B3 Server

In order to keep a version control of my home projects, I decided to set up a subversion server in my B3 Server.

I will be using subversion an Apache.


B3 Server Installation
  • Become root
$ su
  • Install subversion and support for Apache
# apt-get install subversion libapache2-svn
  • Create a base directory for your subversion projects
# mkdir /var/svn
  • Give permissions for Apache
# chown -R www-data:www-data /var/svn
  • Configure Apache svn module
# vi /etc/apache2/mods-available/dav_svn.conf
  • Here's my dav_svn.conf. Be sure to alter SVNParentPath to your subversion projects base directory.
<Location /svn>

  # Uncomment this to enable the repository
  DAV svn

  SVNParentPath /var/svn
  SVNListParentPath on
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /etc/apache2/dav_svn.passwd

  # The following three lines allow anonymous read, but make
  # committers authenticate themselves.  It requires the 'authz_user'
  # module (enable it with 'a2enmod').
  #<LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
    SSLRequireSSL
  #</LimitExcept>

</Location>
  • Restart Apache
# /etc/init.d/apache2 restart
  • Create users for subversion
# htpasswd -cm /etc/apache2/dav_svn.passwd yourusername
  •  Create your projects with the right permissions
# svnadmin create /var/svn/yourproject
# chown -R www-data:www-data /var/svn/yourproject
  • To remove projects
# cd /var/svn
# rm yourproject -R

Client Installation
  • Install subversion
$ sudo apt-get install subversion
  • Connect and sync your projects. This will create a new directory yourproject in your home folder.
$ svn co https://b3server/svn/yourproject
  • Optionally you can install a graphical tool like rabbitvcs, with nautilus integration
$ sudo add-apt-repository ppa:rabbitvcs/ppa
$ sudo apt-get update
$ sudo apt-get install rabbitvcs-nautilus3
$ killall nautilus

You can check out the excito wiki for further details.