Setting up Subversion Repository

Took some time to sneak into the labs and tried hacking around to setup subversion locally. The entire lab runs on RHEL 4. In a few minutes, we got the repository ready and transactions possible over different clients.

* Download the SVN Package from here
* If you are on a Redhat derivative run rpm -ivh package_name.rpm as root
* This should have installed svnadmin and the required client packages.
* To setup a repository you need to run

svnadmin create full_path_to_repository

* Now, you need to configure the EDITOR environment variable so that svn tools can create the log files.

Edit /etc/bashrc and add the following to the end of the file EDITOR = /usr/bin/vim for setting the EDITOR environment variable for all users on the server.

* Save and run the following in a terminal source /etc/bashrc to effect the change in the current terminal session. From the next login onwards (or in a new tab/ window of the terminal emulator like konsole or gnome-terminal) the value of EDITOR will be set automatically (no need to explicitly source it).
* Before you start to create files in the project, you need to get a working copy by:

svn co full_path_to_repository

Above step would create a working copy in the present working directory. cd to the checked out directory.

Now you can create files using your favorite editor or by other means.

* Use svn ci file_name to commit the changes.

These following steps would help you to configure the SVN server so that the clients can checkout and update the repository.

* cd to the repository directory.

* Inside the conf directory, edit the file svnserve.conf and add the following:

[general]
anon-access = read
auth-access = write
password-db = passwd
realm = My First Repository

* Now create a file name passwd in the same directory (conf) and add the following into it:

[users]
USERNAME = PASSWORD

* Now run svnserve -d from inside the repository directory.

* This runs svnserve as a standalone daemon.
* There is another option -i to run it through the inetd super-server (or its variants like xinetd) .

You are good to go!

svn Client Installation

* Install the same package you downloaded in the client machines.

* Connect and list the files in the svn serve using svn ls svn://[ip of the server]/[full path to the repository].

* Check out the code using svn co –username [username] –password [password] svn://[ip of the server]/[full path to the repository].

You are done!

You may still want the manual to understand how things are done.  Download it here.

Leave a Reply

Your email address will not be published. Required fields are marked *