Subversion at home

I decided to try the new version of Ubuntu and create a subversion server at home.

I carried out the following steps

1) Installed Ubuntu

2) sudo apt-get install subversion and sudo apt-get install apache2

3) sudo apt-get install libapache2-svn

4) Create repository

mkdir /home/user/repository

5) Change ownership of repository and the data that will go in it to the apache user

chown www-data:www-data -R /home/user/repository
chown www-data:www-data -R/home/user/data_to_go_in_repository

6) Change repository access level

chmod 770 -R /home/user/repository

7)Create new user for subversion

/usr/bin/htpasswd -c /etc/apache2/dav_svn.passwd username

8\) su www-data

9) svnadmin create home/user/repository/main

10) svn import /home/user/data_to_be_hosted_in_repository file:///home/user/repository/main -m “first import”

11) edit the /etc/apache2/mods_available/dav_svn.conf file(important parts are in bold below)

# dav_svn.conf – Example Subversion/Apache configuration
#
# For details and further options see the Apache user manual and
# the Subversion book.
#
# NOTE: for a setup with multiple vhosts, you will want to do this
# configuration in /etc/apache2/sites-available/*, not here.
# <Location URL> … </Location>
# URL controls how the repository appears to the outside world.
# In this example clients access the repository as http://hostname/svn/
# Note, a literal /svn should NOT exist in your document root.
<Location /svn>

# Uncomment this to enable the repository
DAV svn
# Set this to the path to your repository
SVNPath home/user/repository/main
# Alternatively, use SVNParentPath if you have multiple repositories under
# under a single directory (/var/lib/svn/repo1, /var/lib/svn/repo2, …).
# You need either SVNPath and SVNParentPath, but not both.
#SVNParentPath /var/lib/svn
# Access control is done at 3 levels: (1) Apache authentication, via
# any of several methods. A “Basic Auth” section is commented out
# below. (2) Apache <Limit> and <LimitExcept>, also commented out
# below. (3) mod_authz_svn is a svn-specific authorization module
# which offers fine-grained read/write access control for paths
# within a repository. (The first two layers are coarse-grained; you
# can only enable/disable access to an entire repository.) Note that
# mod_authz_svn is noticeably slower than the other two layers, so if
# you don’t need the fine-grained control, don’t configure it.
# Basic Authentication is repository-wide. It is not secure unless
# you are using https. See the ‘htpasswd’ command to create and
# manage the password file – and the documentation for the
# ‘auth_basic’ and ‘authn_file’ modules, which you will need for this
# (enable them with ‘a2enmod’).
AuthType Basic
AuthName “Subversion Repository”
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user

# To enable authorization via mod_authz_svn
#AuthzSVNAccessFile /etc/apache2/dav_svn.authz
# 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
#</LimitExcept>
</Location>

12) restart apache

sudo /etc/init.d/apache2 start

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