Sunday, April 27, 2008

Using `cvsd' to setup cvs pserver

CVS was designed to use `xinetd' to startup service. But now most Linux distributions do not install xinetd by default, and configuration of CVS is somewhat complicated. `cvsd' is a wrapper program for CVS in pserver mode, it can startup CVS as a standalone daemon, under a special uid/gid in a chroot jail. It is relatively easy to use cvsd and its configuration file to setup CVS repositories.

In this article, I will describe how to setup a cvs pserver step by step.

1. Installation of cvsd package

For RPM-based distributions, you may download precompiled RPMS from this site:
cvsd-1.0.14-1.i386.rpm
cvsd-1.0.14-1.src.rpm (source)
For other distributions, you may download source tarball here, compile and install it yourself.


2. Configuration file /etc/cvsd/cvsd.conf

Check cvsd's configuration file /etc/cvsd/cvsd.conf. Something should be mentioned:

  • RootJail: the location of the chroot jail cvs should be run in. The default value should like
    RootJail /var/lib/cvsd
    For RPM-based installation, the installation process should have initialized this directory for you, by the command
    # cvsd-buildroot /var/lib/cvsd
    If the directory is not initialized yet, or you change `RootJail' to another directory, you need to use the command `cvsd-buildroot' to initialize it by hand.

  • Uid and Gid: the user and group cvsd should be run as. The default values:
    Uid cvsd
    Gid cvsd
    For non-RPM based installation, you need to create them by hand.

  • Repos: paths to repositories, one repository per line. Every path is relative to RootJail and begins with a `/'. For example:
    Repos /coolsoft
    Repos /hotsoft
3. Creation of repositories

To create a repository, for example, `coolsoft', use the command:
# cvs -d /var/lib/cvsd/coolsoft init
The command will create a directory /var/lib/cvsd/coolsoft and a CVSROOT tree in it.

If you allow users to create top level directories in this repository:
# chown cvsd:cvsd /var/lib/cvsd/coolsoft
Edit the file /var/lib/cvsd/coolsoft/CVSROOT/config and modify the `LockDir' option:
LockDir /tmp/coolsoft
The directory is relative to `RootJail', /var/lib/cvsd. Create the directory:
# mkdir /var/lib/cvsd/tmp/coolsoft
# chown cvsd:cvsd /var/lib/cvsd/tmp/coolsoft
Now create users that can access this repository and set the passwords:
# cvsd-passwd /var/lib/cvsd/coolsoft jack
If you want anonymous access to your repository, create a user named `anonymous' or `anoncvs', and leave the password blank:
# cvsd-passwd /var/lib/cvsd/coolsoft anoncvs
Create a new file /var/lib/cvsd/coolsoft/CVSROOT/writers:
# touch /var/lib/cvsd/coolsoft/CVSROOT/writers
to protect write access to the repository. Without this file, all users have write access! Add users you want write access to this file, one user per line.

Optional, create top level directories in your repository that will hold files committed:
# cd /var/lib/cvsd/coolsoft
# mkdir client server
# chown cvsd:cvsd client server
4. Startup cvsd and test your repositories

To startup cvsd, use the command
# /etc/init.d/cvsd start
To test the new repository:
# cvs -d :pserver:jack@myhost.at.office/coolsoft login
# cvs -d :pserver:jack@myhost.at.office/coolsoft co client

5 comments:

  1. I get a "rtld(GNU_HASH) is needed by cvsd-1.0.14-1.i386" dependency message when I try to install cvsd using rpm. How do I either get it or get around it.

    RedHet Enterprise Linux 2.6.9-42.0.3.EL.BZ237861.HOTFIXsmp

    ReplyDelete
  2. Rebuild the RPM using the source RPM provided above:

    rpmbuild --rebuild cvsd-1.0.14-1.src.rpm

    ReplyDelete
  3. piano tuners...

    Megacool Blog indeed!... if anyone else has anything it would be much appreciated. Great website Enjoy!...

    ReplyDelete
  4. That particular approach in home designing is definitely something
    else. In some ways a custom made property is more valuable
    since you know how you're going to use it, since you built everything.
    These figures reflect bad home builders that are either incompetent with their line of
    work or those who are trying to defraud their customers.

    ReplyDelete
  5. I like the helpful info you provide to your articles.
    I will bookmark your blog and test once more right here regularly.
    I am relatively certain I will learn lots of new stuff proper right here!

    Good luck for the next!

    ReplyDelete