Subversion (SVN) configuration with Apache2 and Eclipse integration (Ubuntu envionment)

  1. Install SVN on your machine
    <apt-get install subversion libapache2-svn>

  2. Creating the repository structure
      - The projects will be hosted on repository location so create the repository directory and and give full permission to the apache user (www-data) on those directories:
    Eg: mkdir /usr/local/svn/
         mkdir /usr/local/svn/repository

      - Provide access to apache user on those directories
    Eg: chown www-data:www-data -R /usr/local/svn/repository
         chmod 770 -R /usr/local/svn/repository

  3. Configuring Apache

      - Apache configuration files need to be modified to provide permission and repository information.   - edit the file /etc/apache2/mods-available/dav_svn.conf and do the following modification in the file: ...
    <Location /sample>
    ...
    SVNPath /usr/local/svn/repository
    .....
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/dav_svn.passwd
    ....
    Require valid-user
    ...
  4. To add users to the repository use the following command:
        htpasswd2 -c /etc/apache2/dav_svn.passwd <username>
        Eg: htpasswd2 -c /etc/apache2/dav_svn.passwd testuser


  5. Repository Creation

      - login as apache user
        su www-data

      - create the repository
        svnadmin create /usr/local/svn/repository

      - import your project
        svn import /path_to_projectfolder file:///usr/local/svn/repository/samplev1 -m"initial import"

      - logout/exit from apache user(Ctrl-D) and restart apache
        /etc/init.d/apache2 restart

  6. To integrate with eclipse add the subversion plugin (subclipse) - download it from http://subclipse.tigris.org/


  7. After the plugin installation. In eclipse select Window > Open perspective > SVN Repository Exploring.
        - In SVN Repository window > Add SVN Repository.
        - In 'Add SVN Repository' dialog, provide the url http://hostname/sample and click finish button. (Enter the user name and password to access the contents)
        - In 'SVN Repository' explorer, select repository and check out. It will prompt to create the new project in eclipse.



  8. To setup with eSVN (the GUI for svn) use the following steps:

    1. Check out the repository in the working directory.
         File > Check out
         In CheckOut dialog,
          - provide the URL as the repository: file:///usr/local/svn/repository/samplev1
          - LocalPath as any working directory (this will form the root in the apache hierarchy)


    2. After checkout. Open the local directory as the working directory. Start adding files.

    3. << Back to Tech Archives