This was my first assignment for 2011 and I used this blog post as a precious reference.

I assume that, at this point, SSH server and Apache are already installed and running. Let’s start :

  1. Install the SVN packages
    aptitude install subversion
    aptitude install libapache2-svn
  2. Create a repository for your project(s)
    mkdir /var/subversion
    svnadmin create –fs-type fsfs /var/subversion/project1
  3. Change the repository rights so that Apache can access/write in it
    chown -R www-data:www-data /var/subversion
    chmod -R 770 /var/subversion
  4. Enable the SVN module for Apache
    a2enmod dav
    a2enmod dav_svn
  5. Create the accounts for your SVN user(s) and enter the password (twice) when prompted
    htpasswd -c /etc/apache2/svn.passwd user1
  6. Create the VirtualHost used to access your subversion ie subversion.yourdomain.com containing the following code
    <Location /project1>
    DAV svn
    SVNPath /var/subversion/project1
    AuthType Basic
    AuthName “Subversion Repository”
    AuthUserFile /etc/apache2/svn.passwd
    Require valid-user
    </Location>
  7. Restart Apache with
    apachectl configtest
    apachectl restart
  8. Browse to your repository (you should be at revision 0)
    http://subversion.yourdomain.com/project1
  9. Import files in project 1
    cd /var/www/project1
    svn import -m “importing project1 to svn” http:/subversion.yourdomain.com/project1
  10. Refresh your browser window, your files should be there and you should be at revision 1

If you have been migrating a Subversion repository using this tutorial, you can use the following command to relocate your local copy

svn switch –relocate http://old_url/subversion-repository http://shiny_new_url/subversion-repository

That’s it. Everything works, next, if you so desire, you can enable SSL for your repository access

  1. Install the SSL packages
    aptitude install openssl
    aptitude install ssl-cert
  2. Generate your certificate with the following command (and answer the questions that follow)
    openssl req  -new -x509 -days 365 -nodes -out /etc/apache2/apache.pem -keyout /etc/apache2/apache.pem
  3. Enable SSL in the Apache configuration
    Listen 443
    NameVirtualHost *:443
  4. Edit the subversion virtual host so that
    it listens on port 443 <NameVirtualHost *:443>
    add SSLEngine on
    and SSLCertificateFile /etc/apache2/apache.pem
    in the Location node, add SSLRequireSSL
  5. Activate the SSL module
    a2enmod ssl
  6. Again, restart Apache
    apachectl configtest
    apachectl restart

That much is done, too!

One last – optional – step : specify different access level to different users

  1. Create your subversion users using
    htpasswd /etc/apache2/svn.passwd user2
    htpasswd /etc/apache2/svn.passwd user3
  2. Edit your VirtualHost for subversion.yourdomain.com and add
    AuthzSVNAccessFile /etc/apache2/svnaccess.authz
  3. Edit (or create) the file /etc/apache2/svnaccess.authz using the example below
    [groups]
    group1 = user1, user2
    [/]
    @group1 = rw
    [/project2]
    user3 = rw
  4. Restart Apache and test your access restrictions
    apachetcl configtest
    apachectl restart

That’all. Happy New Year!

Filed under: Debian, Système

Tagged with: , , ,

Liked this page?

Tweet it

Subscribe to the RSS feed or sign up for the newsletter now.

Posts related to Installing SVN on a clean Debian Etch install

1 Comment to "Installing SVN on a clean Debian Etch install"

  1. Trackback on Samantha Halfon on January 1, 2011 at 3:46 pm

    New blog post: Installing SVN on a clean Debian Etch install: This was my first assignment for 2011 and I used t… http://bit.ly/gx0VmB

Name (required)

Email (required)

Website

Leave a Reply

  • About Me


    photo of Samantha Halfon Samantha Halfon
    Software Engineer
    blueKiwi software
    Paris, France
    I enjoy playing with my computer(s), listening to Bob Dylan (and related artists) and watching movies (especially if they were directed by Martin Scorsese or John Cassavetes). Sometimes, I play a little guitar... If not doing any of the above, I am either riding a small red bike around Paris, or, making videos. About my videomaking please check out World Wide Angle and its blog.