Sunday, December 20, 2009

Subversion + Apache + Eclipse on Ubuntu 9.10 - the Karmic Koala

It's been many years I have been using Subversion (SVN), but didn't care much to know how it's installed, administrated & accessed over internet.

Here I will show you how to install & configure Subversion, Apache, to access Subversion over internet & accessing Subverion in Eclipse.

1) Installing Subversion

    a) sudo apt-get install subversion
       This will install Subversion

    b) sudo mkdir /var/svn
       This will create Subversion repository directory, I have choose to have it in /var, you can choose any other directory you want

2) Installing / Configuring Apache

    a) sudo apt-get install apache2 libapache2-svn
       apache2 (Apache 2 Http server), libapache2-svn (Apache module for SVN)
    b) gedit /etc/apache2/mods-available/dav_svn.conf

        I) Uncomment "DAV svn"

       II) SVNParentPath /var/svn - This you need to set if you want multiple repositories under a single directory
           SVNPath /var/svn/repo1 - This is when you just need a single repository
           For this example I will be using SVNParentPath set to /var/svn
      III) Uncomment / Set the below variables as

            AuthType Basic
            AuthName "Subversion Repository"
            AuthUserFile /etc/apache2/dav_svn.passwd

      IV) sudo /etc/init.d/apache2 restart

3) Creating Subversion repositories

    1) sudo mkdir /var/svn/project1
        sudo svnadmin create /var/svn/project1
        sudo svn mkdir file:///var/svn/project1/trunk -m "Trunk"
        sudo svn mkdir file:///var/svn/project1/tags -m "Tags"
        sudo svn mkdir file:///var/svn/project1/branches -m "Branches"

    2) sudo chown -R www-data.www-data /var/svn

4) Creating Users to access repository

    sudo htpasswd -c /etc/apache2/dav_svn.passwd user1

    Now if you hit http://localhost/svn/project1, you should be able to see trunk, branches & tags folder for project1 listed.

5) Configuring Eclipse to use Subversion

    I don't know there may be many plugins available, but I use Subversive plugin.

    a) Install Subversive plugin

    b) Go to SVN Repository Exploring perspective

    c) In SVN Repositories tab, Right click -> New -> Repository Location

        Enter http://localhost/svn/project1 into URL
        Enter user1 in User and the password
        Click on Finish

       You should be able to see the project1 repository along with its trunk, branches & tags folders.

Happy code versioning ..

Cheers !!

No comments:

Post a Comment