Monday, February 2, 2009

Subversion setup on Solaris for Access Control

What is Subversion

Subversion is a free/open-source version control system. That is, Subversion manages files and directories over time. A tree of files is placed into a central repository. The repository is much like an ordinary file server, except that it remembers every change ever made to your files and directories. This allows you to recover older versions of your data, or examine the history of how your data changed. Subversion can access its repository across networks, which allows it to be used by people on different computers. http://subversion.tigris.org/

Architecture

On one end is a Subversion repository that holds all of your versioned data. On the other end is your Subversion client program, which manages local reflections of portions of that versioned data (called “working copies”). Between these extremes are multiple routes through various Repository Access (RA) layers. Some of these routes go across computer networks and through network servers which then access the repository. Others bypass the network altogether and access the repository directly


Installation

Go to http://www.sunfreeware.com/programlistsparc9.html (Search for subversion-1.4.3-sol9-sparc-local.gz or subversion)

Extract the installable and also download below listed pre-requisite softwares that required for sub version from the same site.

  • apache-2.0.59
  • neon-0.25.5
  • swig-1.3.29
  • openssl-0.9.8c
  • db-4.2.52.NC
  • expat-1.95.5
  • gdbm-1.8.3
  • libiconv-1.9
  • libgcc-3.4.6
  • libxml2-2.6.26
  • zlib-1.2.3
  • openssl-0.9.8e

Make ftp all the above installables to Solaris system.

Most of the installables are in the form of .gz/.z extensions, we need to extract them using gunzip/gzip utility.

For example, gunzip subversion-1.4.3-sol8-sparc-local.gz this extracts the actual installable to current directory. After running this command, user can observe this file in the current directory, subversion-1.4.3-sol8-sparc-local, which is the actual installable package.

Run the below command to install the package.

pkgadd –d subversion-1.4.3-sol8-sparc-local

Follow the below steps to install all other pre-requisite softwares.

  1. gunzip (e.g., gunzip db-4.2.52.NC-sol9-sparc-local.tar.gz)
  2. pkgadd –d (e.g., pkgadd -d db-4.2.52.NC-sol9-sparc-local.tar)

Repository

Use the svnadmin utility to create the repository.

svnadmin create /subversion/repository This command creates a new directory /subversion/repository and stores repository related information like Berkeley DB, conf etc., Once the repository is created, we need to import the directories & files into the SVN repository using the following procedure.

1. Create a directory structure and files on your hard disk

  • mkdir /root
  • mkdir /root/nodes
  • mkdir /root/nodes/node1
  • mkdir /root/nodes/node2
  • mkdir/root/nodes/node1/leaf1
  • mkdir /root/nodes/node2/leaf2

2. Use the import command and import the structure into SVN repository

svn import /vzw file:///subversion/repository -m "initial import

Subversion Server

A Subversion repository can be accessed simultaneously by clients running on the same machine on which the repository resides using the file:/// method. But the typical Subversion setup involves a single server machine being accessed from clients on computers all over the office—or, perhaps, all over the world.

There are two ways to setup the subversion server. One is Apache Webserver in which the server can be accessed using normal http protocol and another is svnserve a small, standalone server program that speaks a custom protocol with clients.

In this version, we’ll be configuring svnserve server.

Run the below command to start the svnserve server as a standalone “daemon” process.

svnserve -d -r /subversion/repository

-r option effectively modifies the location that the program treats as the root of the remote filesystem space. By using this option, user doesn’t need to give the absolute path of the repository while checking out.

svn checkout svn://host.example.com/project1 (If uses –r option)

svn checkout svn://host.example.com/subversion/repository/project1 (without –r option)

Authentication & Authorization

When a client connects to an svnserve process, the following things happen:

· The client selects a specific repository.

· The server processes the repository's conf/svnserve.conf file, and begins to enforce any authentication and authorization policies defined therein.

· Depending on the situation and authorization policies,

o The client may be allowed to make requests anonymously, without ever receiving an authentication challenge, OR

o The client may be challenged for authentication at any time

In this version, we are setting of Read/Write access for the set of users and Read access for anonymous uses on the repository.

1. Go to the repository installation folder and followed by conf

a. cd /subversion/repository/conf

2. Open the svnserv.conf file in vi/text editor

3. Un comment the below two lines, which enables read access for anonymous users and Write access for authenticated users.

anon-access = read

auth-access = write

4. Un comment the below line and give the value of the realm as Repository’s uuid. To find out this uuid, go to db folder under repository (cd /subversion/repository/db) and display the contents of uuid file (cat uuid).

realm = 5f437005-2437-0410-b26a-d6881fc15dd9

5. Save the file and close the editor

6. Open the passwd file in vi/text editor from conf directory

7. Enter the user names along with the passwords that you want to give write access. Finally the file should look like below, if you add 5 users. # represents for commented line which comes with the default file.

[users]

# harry = harryssecret

# sally = sallyssecret

svnuser = svnpwd

8. Save the file and close the editor.


No comments: