← All posts

FreeBSD. Installing and Configuring Subversion

subversion

Subversion is a free, centralized version control system.

Subversion was designed specifically to replace the outdated CVS system,
a widely used open-source version control system.

Subversion has all the core features of CVS (although it implements some of them differently) and is free of a number of its shortcomings.

Installation

First, let’s build Apache with Berkeley DB support, since this is the data storage method I prefer.

cd /usr/ports/www/apache22/
make install WITH_BERKELEYDB=db42

If Apache is already installed, then

make reinstall WITH_BERKELEYDB=db42

as a last resort, if rebuilding Apache is not possible, then

make deinstall && make clean

you can also clean things up

rm -rf /usr/ports/distfiles/*

and then try the installation again!

To launch Apache at system startup, add this to /etc/rc.conf

apache2_enable="YES"

Next, install Subversion

cd /usr/ports/devel/subversion
make config

select MOD_DAV_SVN and BDB

make install

Check whether these entries exist in /usr/local/etc/apache22/httpd.conf


LoadModule dav_svn_module     libexec/apache22/mod_dav_svn.so
LoadModule authz_svn_module   libexec/apache22/mod_authz_svn.so

Where “libexec/apache22/” is your path to Apache’s modules.

Restart Apache


apachectl restart

Creating a Repository

The directory for the repository

mkdir -p /home/svn/repos

The directory for your project

svnadmin create /home/svn/repos/_project_/

Replace _project_ with the name of your project (directory).

Import the project into the repository

cd /home/_project_/
svn import ./ file:///home/svn/repos/_project_ --message 'Initial repository layout'

Set the web server permissions

chown -R www:www /home/svn/

Add this to /usr/local/etc/apache22/httpd.conf



<location /svn>
   DAV svn

   # разрешает выдавать перечень всех доступных хранилищ в папке SVNParentPath
   SVNListParentPath on
   SVNParentPath /home/svn/repos
   SVNPathAuthz off

   # включения базовой аутентификации, т.е. имя_пользователя/пароль
   AuthType Basic
   AuthName "Subversion repository"
   AuthUserFile /home/svn/svn-auth-file

   # предписывает, что только пользователям, предоставившим правильные имя_пользователя/пароль,
   # будет разрешён доступ к URL
   Require valid-user
</location>

Now, let’s create users to access your project


htpasswd -cmb /home/svn/svn-auth-file _user_ _password_

and add users, since the “-c” flag specifies that the file should be created


htpasswd -mb /home/svn/svn-auth-file _user_ _password_

Where _user_ and _password_ are the username and password, respectively.

Well, that’s it—happy checking out!


svn checkout http://_domain_/svn/_project_

P.S. Subversion 1.5

UPDATE: Configuring Groups and Permissions in Subversion

Comments are closed. Read the original discussion in Russian →