Install Subversion on Debian

First of all, install these packages: apache2, php5, subversion.

# apt-get install apache2
# apt-get install libapache2-mod-php5
# apt-get install subversion
# apt-get install libapache2-svn

Create repository folder.

# mkdir /subversion
# svnadmin create --fs-type fsfs /subversion/kendal

Make sure subversion is activated in apache.

# a2enmod dav
# a2enmod dav_svn

Create user account for subversion.

# htpasswd -c /subversion/passwd user1

(remove option  -c if passwd file exists)

Edit /etc/apache2/ports.conf file and add this line:

Listen 10001

Edit /etc/apache2/default file.
Change NameVirtualHost * to NameVirtualHost *:80
Add this line:

NameVirtualHost *:10001

Change <VirtualHost *> to <VirtualHost *:80>

Create /etc/apache2/sites-available/subversion file and type in these lines:

NameVirtualHost *:10001
<VirtualHost *:10001>
ServerAdmin admin@svn
ServerName svn.colibri.co.id
LoadModule dav_module /usr/lib/apache2/modules/mod_dav.so
LoadModule dav_svn_module /usr/lib/apache2/modules/mod_dav_svn.so
#LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so == this line is not used
<Location / >
Order allow,deny
Allow from all
DAV svn
SVNParentPath /subversion
AuthzSVNAccessFile /subversion/authfile
Satisfy Any
Require valid-user
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /subversion/passwd
</Location>

ErrorLog /subversion/error.log
LogLevel warn
CustomLog /subversion/access.log combined
</VirtualHost>

Create symbolic link:

# ln -s /etc/apache2/sites-available/subversion /etc/apache2/sites-enabled/subversion

Create file for access permission in /subversion/authfile which contains the following lines:

[groups]
owner=taukhid
programmer=adji, purwo
[/]
@owner=rw
@programmer=r
[/kendal]
@programmer=rw

Change repository folder owner to apache user:

# chown -R www-data:www-data /subversion

Restart apache:

# apache2ctl restart

Test the repository in browser:  http://svn.colibri.co.id/kendal/

Reference:
http://subversion.tigris.org/

Leave a Reply

Your email address will not be published. Required fields are marked *