Subversion

1.0 INTRODUCTION
How many times have you been working on a word document, spreadsheet or a project and you save over something you like or have changed without a backup? Have you been working with others on a programming project and someone has not given you their up to date files or their new files do not work correctly? If the answer is even once, Subversion may be something you should look into. Subversion allows users to save “versions” of their files on a central computer. The other nice thing about subversion is it allows remote connection so you can work on projects at different geographical locations. The following technical HOWTO will walk you through setting up a subversion server with 3 repositories, one public; accessible to everyone, one private; accessible to a user group, and on that is limited to an IP range.
2.0 PROJECT
I. Requirements
• Linux based computer for server (Redhat)
• Windows based PC for client (Vista)
• Internet connection
• FQDN (my-server.kylecorey.ca)

II. Installation
• We need to update our Linux servers with the latest versions of Apache , Subversion and WebDev.

• yum install yum install httpd mod_dav_svn mod_ssl subversion php

• This installs all of the necessary files needed for Subversion to work.

III. Configuration
We need to create the directory structure that will hold the repositories, users, and permissions.

• cd /

• mkdir /svn

• mkdir /svn/repos

• mkdir /svn/permissions

• mkdir /svn/users/

• Now we need to have Apache own these files so that it can access them and edit them

• chown –R apache.apache /svn

Next we need to create the repositories

• cd /svn/repos

• svnadmin create public

• svnadmin create private

• svnadmin create itas

We have to edit the httpd.conf file to allow communication between Apache and the repositories this file can be found at
/ect/httpd/conf/httpd.conf
Add the following file to the bottom of this file. You may have to modify it to make it work with your configuration
The PUBLIC repository is accessible by anyone and everyone . It does not require any authorization. This is not recommended as it is very insecure.
< Location /subversion/public>
DAV svn
SVNPath /svn/repos/public/
< /Location>
The PRIVATE repository is only available to a predefined group of users and they will need to provide a user name and password to access the files.
< Location /subversion/private>
DAV svn
SVNPath /svn/repos/private/
AuthzSVNAccessFile /svn/permissions/svnauthz.conf
AuthType Basic
AuthName "Private Repository"
AuthUserFile /svn/users/passwords
Require valid-user
< /Location>

The ITAS repository is a repository that is only available to a network IP range. In this case we are using the 142.25.97.xx
< Location /subversion/ITAS>
DAV svn
SVNPath /svn/repos/ITAS/
AuthzSVNAccessFile /svn/permissions/svnauthz.conf
Order deny,allow
deny from all
allow from 142.25.97
< /Location>
We still need users. For this we will use htpasswd. This is how you make a user repeat as needed.

• htpasswd –cb /svn/users/passwords/ user password

• htpasswd –b /svn/users/passwords/ user2 password

Note that you only use the c tag on the first user.

Now that we have created the users with passwords we need to edit yet another file which will control which users can access what repositories.

• vi /svn/permissions/svnauthz.conf

The groups will be the first entry

• [group]
admin = one, two
users = three, four, five, six

• Next we set up which users can access what repositories.

• [public:/]
* = rw

• This allows anyone to access read and write to the public repository

• [private:/]
@admin = rw
@users = rw

• This allows the admin group and the users group to have read and write access.

• [itas:/]
* = rw
• Because we have limited the users of this repository to be on the 142.25.97 network they do not need to have groups and users.
IV. Testing

Now the repositories are set up we can begin testing. We will test all 3 repositories. Open all of these web address in your web browser to test each repository and users.

• my-server.kylecorey.ca/subversion/public

This should open up because it is open to everyone.

• my-server.kylecorey.ca/subversion/private

This will prompt you for a username and password. Try a few of your usernames to test to see that they work

• myserver.kylecorey.ca/subversion/itas

This will work if you’re on the network that you configured in the httpd.conf file. To test to see if it does not work, use a computer on another network, or edit the httpd.conf file to a different network then it should fail.

• Download tortoise from http://tortoisesvn.net/downloads and install it. This program will allow you to upload and download files from the repositories. After it is installed create some folders on your desktop, open on and right click in the folder and select SVN commit to establish connection with your repository. Enter each repository to test from windows as you did from the web browser.
• Hopefully all your tests passed, if not you may have to play a bit with the conf files. It always seems to be the case disto to distro.

V. BACK UP
It is always a good idea to have a backup plan in case the unthinkable happens. One of the simplest ways to backup configuration files or to tar them and saving them on disk or on another server.

• Lets backup httpd.conf to /backup and tar /svn
cp /etc/httpd/conf/httpd.conf /backup/httpd.conf
tar –cvf /svn/ /backup/svn.tar

3.0 SUMMARY
As you can see Subversion is a very useful tool for home or business. It is a great way to backup files, save revisions of files or share files with others. With a little effort this can be completed in under 1 hour with no real big snags.