SVN: Install on 5.0-Nano

Revision as of 09:17, 15 August 2009 by Ric (talk | contribs) (New page: {{SVN Nav}} '''Installing SVN on 5.0-Nano''' The following step-by-step guide shows how to install Subversion on Uniform Server 5.0-Nano. In addition introduces a portable SVN client that...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

 

MPG

Uniform Server 5.0-Nano.
Subversion (SVN)

Installing SVN on 5.0-Nano

The following step-by-step guide shows how to install Subversion on Uniform Server 5.0-Nano. In addition introduces a portable SVN client that is in keeping with Uniform Server’s philosophy of leaving no dust on a host PC.

This set-up allows you to explore and become confident with SVN. If you break something there is nothing to uninstall, just delete the files and start again.

Top

Downloads General

All software used in this tutorial is available from Tigris.org they provide open source software engineering tools.

Under featured projects are the tools we require Subversion, RapidSVN and optionally TortoiseSVN (Note: Integrates into Windows Explorer hence not portable)

Top

Portability General

When installing programs executables are placed on a system path allowing them to be easily found by the operating system. Alternatively you may be requested to manually set a path to the executables. Certainly not consistent with portability, however if you open a command prompt and change-working directory to where the executables reside they can be run using command line options. To make this task a little easier I use batch files see later.

There are no restrictions where subversion tools, RapidSVN or repositories are located. However I want to retain portability, by this I mean copy folder UniServer and all its content to a USB memory stick hence for convenience all SVN tools and repositories are located in the UniServer folder.

Top

Install SVN on UniServer

The following assumes you installed (extracted) Uniform Server 5.0-Nano to folder C:\a_svn\UniServer

If you installed to another location substitute paths accordingly.

1) Run servers once and check they function. This also configures server's internal paths.
2) Inside folder C:\a_svn\UniServer create two new folders svn_tools and svn

C:\a_svn\UniServer\svn_tools
C:\a_svn\UniServer\svn

You can choose different names and locate these outside of the UniServer folder.
Remember we are placing these here for portability.
Folder svn will contain our repositories.
3) Download File: svn-win32-1.6.3.zip or newer.

Located at the bottom of this page: tigris.org
Extract to any folder

Make sure any newer version is compatible with the version of Apache.
4) Copy the entire content of folder svn-win32-1.6.3\svn-win32-1.6.3

To folder C:\a_svn\UniServer\svn_tools
Folder svn_tools will now contain folders bin, iconv, licenses,
share and file README.txt

Once copied if you wish to save space delete the extracted files
and svn-win32-1.6.3.zip they are no longer required.
5) Navigate to C:\a_svn\UniServer\svn_tools\bin

Move files: mod_authz_svn.so and mod_dav_svn.so
To folder: C:\a_svn\UniServer\usr\local\apache2\modules

Move the two modules to Apache's module folder;
6) Navigate to C:\a_svn\UniServer\svn_tools\bin

Copy these files:

  • intl3_svn.dll
  • libdb44.dll
  • libsvn_delta-1.dll
  • libsvn_fs-1.dll
  • libsvn_repos-1.dll
  • libsvn_subr-1.dll

To: C:\a_svn\UniServer\usr\local\apache2\bin

The above two modules have dependencies (dlls),

Apache resolves dependences by first looking in
its bin folder and then looks along system paths.


Generally these dlls are located on a system path
however we want a portable installation hence they
are copied to Apache’s bin (binary) folder.

7) Edit file: C:\a_svn\UniServer\usr\local\apache2\conf\httpd.conf

Confirm these modules are enabled as shown:

LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
Configure Apache to use the subversion module.

First check these modules are enabled.
Note, mod_dav.so is enabled by default.

8) At the end of load modules section add these two lines:
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
The two lines inform Apache to load the svn modules.
Add them just below:
LoadModule vhost_alias_module modules/mod_vhost_alias.so
9) At the end of httpd.conf, add the following block of code.
<location /svn>
  DAV svn
  SVNListParentPath on
  SVNParentPath C:/a_svn/UniServer/svn
</location>

  • svn Top level folder name http://localhost/svn/*** any name after svn is assumed a repository request and passed to DAV for resolving
  • DAV svn Instructs Apache to pass the request onto the DAV layer for processing as a subversion (svn) request.
  • SVNListParentPath on Enables listing of all repositories for URL http://localhost/svn
  • SVNParentPath Absolute path to the parent folder containing all the repositories.

Testing SVN server

  • Restart Servers
  • Access the SVN repository. Type the following into a browser http://localhost/svn

Page displays

Collection of Repositories
page Powered by Subversion version 1.6.3 (r38063).

This confirms Apache has been configured correctly. Next step is to create an SVN repository.

Top

Creating a repository

When you attempt to create a repository using RapidSVN it informs you to use the command line tool svnadmin.exe

This section shows how to create a repository using this tool and how to add a working project.

Top

Batch file

I previously mentioned to run the admin tools requires opening a command prompt and navigating to the svn_tools executables folder .

This I find very tedious hence create the following batch file in folder C:\a_svn\UniServer\svn_tools\bin

Name the batch file whatever you like I have named it z_start_svn_command_prompt.bat add the following content:

start "SVN COMMAND PROMPT" cmd.exe /k "COLOR B0" 

Double click to run, a new command prompt is opened and the working folder is automatically set.

Top

Create a repository

You need to create at least one blank repository choose a name that matches your project for this example I will use “myproject

Run the batch file above and type the following command:

svnadmin.exe create ..\..\svn\myproject
  • svnadmin.exe Runs the subversion administration program.
  • create Is the command to be run by svn admin. It creates a repository named myproject.
    • Note: You can specify an absolute path or a relative path to the folder myproject.
      For example:
      Absolute: C:\a_svn\UniServer\svn\myproject
      Relative: ..\..\svn\myproject - as shown above
  • If the folder myproject does not exist it is created. Adds subversion database and tracking folders.

Repository Access

Start the servers. To access repositories type either of the following into a browser:

  1. http://localhost/svn/ -- Displays Collection of Repositories page.
    1. All repositories in folder svn are listed as links.
    2. Currently we have just one repository hence a single link “myproject” is displayed
    3. Click this link to display “myproject” repository.
    4. If you do not want all repositories listed comment this line as shown: #SVNListParentPath on
      Accessing http://localhost/svn/ will now produce Forbidden You don't have permission to access /svn/ on this server.
    5. You can still access a repository by entering its full URL see below.
       
  2. http://localhost/svn/myproject/ -- You directly access a repository by name as shown for "“myproject”.
    Viewing this repository with a browser you will find it empty.
    However view the same folder using Windows Explorer displays several SVN suport folders and files.
    1. Folders: conf, dav, db, hooks and locks
    2. Files: README.txt and format
    3. Never edit or delete the above folders or files. They tag and track all changes in a repository.

Note:

The above is probably the only command line tool you need to use.

However SVN comes complete with several other command line tools including a command line client.

Top

Command line client

Starting with an empty repository you probably want to quickly set it up and publish your current project as it stands.

The following shows a quick way to do this it also includes SVN’s recommended folder structure.

  1. Create a temporary folder for example C:\a_svn_temp
  2. Inside this create three new folders (SVN recommended) named:
    1. trunk
    2. tags
    3. branches
  3. Copy your current stable project into folder trunk -- Note: For testing I copied folder C:\a_svn\UniServer\unicon
  4. Start servers
  5. Run batch file z_start_svn_command_prompt.bat (whatever you named it)
  6. Type the following:
svn.exe import C:\a_svn_temp http://localhost/svn/myproject -m "Initial import"

This updates your repository with new folder structure and project.

View repository, type into browser http://localhost/svn/myproject

  • The project page and status are displayed myproject - Revision 1:


Note: If you do not include -m "Some text" SVN will complain about not being able to find a text editor.

Top

Summary

Using Uniform Server 5.0-Nano and svn-win32 I have shown how to create an SVN server. Covered repository creation and a quick method of installing a project to it.

Command line entry is prone to errors never been a fan of this method hence on the next next page I take a look at a portable GUI.

Top