Homepage of Lars E. Pettersson

CVS - Concurrent Versions System

Info

I will on this page give some information on how I set up a CVS server to be used on my local LAN. The server is placed behind the firewall and is not supposed to be accessible outside of my own LAN. Due to this I can relax the security bit a little

My main objective of this server is to store my coding, mostly C and Perl programs, but also to use it when making home pages.

The following explains how I set up the server on a RedHat 7.3 system. It is not intended for a newcomers, as I do not go into detail on several things. I might add this information later on.

What you need

To be able to set up a server you need the following packages:

The xinetd-package is not needed if you do not intend to access the CVS repository over your LAN, i.e. if you set up the repository on your local machine.

Here we go...

How to use it

A very good introduction is the manual that comes with the source, written by Per Cederqvist et. el. Print it out (182 pages, ouch!) and read it, you will learn a lot, so it is time well spent.

Access via SSH

We can connect to our repository using a SSH tunnel. This can be done by issuing the command ssh -L 2401:localhost:2401 -N -f -g -q -x lars@server.some.org on the client machine. We can now access the repository by using cvs -d :pserver:lars@localhost:/home/cvsroot login and cvs -d :pserver:lars@localhost:/home/cvsroot co module on the client. We may also set the CVSROOT environment variable to :pserver:lars@localhost:/home/cvsroot if this is the preferred repository.

Another, perhaps simpler, way, is the following. Set the environment variable CVS_RSH to ssh. You may now access the repository by issuing the command cvs -d :ext:lars@localhost:/home/cvsroot co module

I have no idea on which of these two are the best, but the latter setup seems simpler. In both versions you need an account on the machine running the cvs server. In the first version the user and group will be determined by how we set up xinetd, in the second version the user and group will be that of the user logging in on the machine. This might be good to know if you have an automatic update of a home page etc. from loginfo.

Need better security?

If you want to make a more secure installation of CVS a chroot variant might be a good choice. Information about this can be found at many places, some that I found interesting where

Automatic update of a home page

If the web server and the cvs repository is on the same computer, one can easily set up cvs to automatically update the web server. To do this checkout the CVSROOT repository, and edit the loginfo file. Add the line (all in one line)

^homepage  (date; cat; (sleep 2; cd /var/www/html/homepage; cvs -q update -d) &) >> /home/cvsroot/CVSROOT/updatelog 2>&1

where homepage is the name of the cvs repository, and /var/www/html/homepage is the directory to put the home page in on the web server. Each time you make a commit command the web page will be updated and a logging message will be appended to the updatelog file.