SVN w/ Apache

Based on: http://www.baccoubonneville.com/blogs/index.php/eclipse/2005/10/15/p111

Installation of Subversion on Windows
First, I want to install Subversion on Windows (don't blame me :-). Here is a quick manual of use of Subversion installation on Windows:

  • Download the latest setup.exe of Subversion for Windows from this link. Launch the installation and follow instructions.
  • Create a directory for the repository to sit in. In my case this was D:\Subversion.
  • Create a repository using the command line option, but don't import anything. There is a QuickStart guide in the README.txt in c:\program files\subversion, but do NOT import any code projects. Just do this at the command line:
		svnadmin create D:\Subversion\repository
		
  • You probably want to create sub-folders Branches, Tags and Trunk. I did this by getting Tortoise and adding them through this.
  • For Windows, you also need a SVN Service Wrapper for Windows. You can download it here. Put the SVNService.exe binary in the c:\Program Files\Subversion\bin diretory. Then type "SVNService.exe -install -d -r D:\Subversion\repository". Go in the Windows services (Start|Control Panel|Administrative Tools|Services) to start the service and to change it to automatic startup instead of manual startup.

Using Subversion with Apache (But you don't need to do this)

  1. Subversion can be used with Apache 2.0. You should download and install it. As I had an EasyPHP with an Apache 1.3 for test purpose that was listening on port 80, I changed this port to port 81. My Apache 2.0 will listen to port 80.
  2. Copy the mod_dav_svn.so and mod_authz_svn.so from C:\Program Files\Subversion\bin to C:\Program Files\Apache Group\Apache2\modules.
  3. Add the following lines in httpd.conf (note that this is only basic authentication. You should use HTTPS):

    # For Subversion modules
    LoadModule dav_module modules/mod_dav.so
    LoadModule dav_svn_module modules/mod_dav_svn.so

    # For Subversion repository
    <Location /repos>
    DAV svn
    SVNPath "D:\Subversion\repository"
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile "D:\Subversion\repository\conf\passwd"
    Require valid-user
    </Location>

  4. Create users in Apache by typing in "c:\Apache Group\Apache 2\htpasswd.exe" -cm "D:\Subversion\repository\conf\passwd" username. Retype the same command without -c to add next users.
  5. Optionally, you can download TortoiseSVN, a subversion client for Windows (it's like TortoiseCVS).
  6. Download and install Subclipse, the Eclipse plug-in for Subversion. Before installating Subclipse, you should first check that Subclipse is not already installed using the following menu: Help | About Eclipse SDK | Plugins. Subclipse is installed with some other plug-ins (when install PHPEclipse for example).
  7. You can use a single browser to view the repository. Type http://127.0.0.1/repos.

Comments:

You need Apache if you want to be able to access to your SVN repository throw WebDAV protocol. To, a simple web browser ou webdav client or file browser (like nautilus or windows explorer) can be enough to work with svn. And it's usefull if you want to re-use security rules of your apache config. But you can use svn+ssh:// protocole over the internet without any problem. You can use Subclipse with svnserve and without Apache. Instead of using a http: scheme in the repository URL, you use svn:, or svn+ssh: over an unsecure network.

Q: Ok, but if I want to use Subclipse with svnserve using svn: over the Internet, I certainly have to configure Subversion to use port 80 or 443 I guess (other ports will be blocked by some firewalls on the other side). Is that correct?

A: In general, firewalls block incomming request and not outcomming ones. So if you want to use svn protocol instead of http over the internet, you just need to configure your server firewall to accepte incomming requests on the svn default port (3690).

Use of Subversion in Eclipse

1. Install the subclipse plugin in your Eclipse.
2. Open the SVN Repository Exploring Perspective (Window | Open Perspective | Other)
3. Right click and choose New | Repository Location…

If not using Apache, type file:///svn_repository (if your repository is at D:\Subversion\repository). Note that file:///D:/Subversion/repository does NOT work, and will give these errors:

Couldn't open a repository
svn: Unable to open an ra_local session to URL
svn: Unable to open repository 'file://D:/Subversion/repository'

while entering file:///D:/Subversion/repository will give you the gnomic:

Error validating location: "org.tigris.subversion.javahl.ClientException:
Bad URL passed to RA layer
svn: Unable to open an ra_local session to URL
svn: Local URL 'file://c:%5Csvn_repository contains only a hostname
no path
"

If using Apache, in URL, type http://127.0.0.1/repos. Enter your login and password.

4. Expand the repository, and the trunk, right-click and then add your base directory for your project (in my case c:\roger_big\ql14, which contained code, html files, access databases). It will all run very quickly.

5. I also added CDT, from http://download.eclipse.org/tools/cdt/releases/callisto. This is because I was working with C/C++.


From an email:

Installed Subclipse on Windows 7. Some more steps were needed:

– SVNService.exe / .zip
– – download path has changed
– – is a .zip now, the .exe is part of SVNService.zip
– – unpack the content (not the folder) of SVNService folder of SVNService.zip to the subversion bin folder

– Run SVNService as Administrator
– – … otherwise ""
– – In Windows 7 open a dos-window (cmd.exe)
– – give this dos-window the Administator right by
– – – dos-window Icon > right click > Eigenschaften/Properties? > Erweitert/Extended? > AlsAdministratorAusfuehren/RunAsAdministrator? |X|
– – – or link a dosAdmin-Icon on your desktop and give it those properties.

– in this dosAdmin window start SVNService.exe as described by your posting.