CVS version control system
Cvs version
Tested with CVS 1.12.7 and cvsd 1.0. (26th June 2005: upgraded to CVS 1.12.12 and cvsd 1.0.7)
Introduction
CVS is the most commonly used
version control system in the Unix/Linux world. The configuration described here allows write access via SSH, and anonymous read access via the CVS
pserver protocol, running in a chroot for security.
Installing CVS
Install
/usr/local/configure-wrappers/configure-cvs.
tar jxf cvs-1.x.y.tar.bz2
cd cvs-1.x.y
/usr/local/configure-wrappers/configure-cvs
make
sudo make install
In
/etc/profile, add
/usr/local/cvs/bin to
LOCAL_PATH, and
/usr/local/cvs/man to
LOCAL_MANPATH. Also add a symlink so CVS-over-SSH will find the
cvs binary:
sudo ln -s /usr/local/cvs/bin/cvs /usr/bin/cvs
Create a repository, setting permissions as described in the
Debian reference manual:
export CVSROOT=/usr/local/cvsroot
sudo /usr/local/cvs/bin/cvs init
cd $CVSROOT
sudo chown root:src .
sudo chmod 3775 .
cd CVSROOT
sudo chown -R root:staff .
sudo chmod 2775 .
sudo touch history val-tags
sudo chmod 664 history val-tags
sudo chown root:src history val-tags
Next, you have to add users that will be using cvs to the system group
src; see
StandardUsersGroups for instructions.
Now edit the CVS config file, by checking it out first:
cd
cvs co CVSROOT
cd CVSROOT
Replace the file
config that you checked out with
this one. Then check it back in:
cvs commit
Installing cvsd
cvsd is a daemon that provides anonymous read access to CVS repositories by implementing the CVS
pserver protocol in a chroot jail. Download the latest stable version. Install
/usr/local/configure-wrappers/configure-cvsd, and make it exectuable. Install cvsd:
tar zxf cvsd-x.y.z.tar.gz
cd cvsd-x.y.z
/usr/local/configure-wrappers/configure-cvsd
make
sudo make install
Set up its init script:
sudo cp /usr/local/cvsd/etc/init.d/cvsd /etc/init.d
sudo update-rc.d cvsd defaults
In
/etc/profile, add
/usr/local/cvsd/sbin to
LOCAL_PATH, and
/usr/local/cvsd/man to
LOCAL_MANPATH.
Create a user and group for it:
sudo addgroup cvsd
sudo adduser --system --ingroup cvsd --home /chroot/cvs --shell /bin/false --gecos 'cvs pserver daemon' cvsd
Install
/usr/local/cvsd/etc/cvsd/cvsd.conf.
Copy your CVS repository into the chroot:
sudo cp -a /usr/local/cvsroot /chroot/cvs
sudo mv /usr/local/cvsroot /usr/local/cvsroot-old
sudo ln -s /chroot/cvs/cvsroot /usr/local/cvsroot
sudo ln -s /chroot/cvs/cvsroot /cvsroot
Build the chrooted file system:
sudo /usr/local/cvsd/sbin/cvsd-buildroot /chroot/cvs
Create a CVS user for anonymous access:
sudo /usr/local/cvsd/sbin/cvsd-passwd /chroot/cvs/cvsroot anonymous
When prompted for the password, leave it blank.
Create a file
/chroot/cvs/cvsroot/CVSROOT/readers, containing the single line:
anonymous
Disallow CVS write access via pserver:
sudo touch /chroot/cvs/cvsroot/CVSROOT/writers
Make a directory for CVS to put its lock files in:
sudo mkdir -p /chroot/cvs/tmp/cvsroot
sudo chmod a+w /chroot/cvs/tmp/cvsroot
Remove the
history file, which just keeps a log of all transfers, and which causes unnecessary warnings because
cvsd can't write to it:
sudo rm /chroot/cvs/cvsroot/CVSROOT/history
Open TCP port 2401 on your firewall. Then start
cvsd:
sudo /etc/init.d/cvsd start
Testing
Import a project into your repository, then check it out. You can see how to do that from the
info cvs manual pages installed onto your server together with the cvs, look for a section called "Creating a directory tree from a number of files". You can find it by browsing following links:
- Starting a project with CVS
- Setting up the files
- Creating a directory tree from a number of files
or, you can read it on the web at
this page.
To test pserver access, try something like this:
cvs -d :pserver:anonymous@myserver.example.org:/cvsroot login
cvs -z3 -d :pserver:anonymous@myserver.example.org:/cvsroot checkout myproject
If it works, you can delete the old copy of your repository:
sudo rm -rf /usr/local/cvsroot-old
Upgrading
If you upgrade CVS, you'll need to run this again:
sudo /usr/local/cvsd/sbin/cvsd-buildroot /chroot/cvs
To upgrade cvsd:
tar zxf cvsd-x.y.z.tar.gz
cd cvsd-x.y.z
/usr/local/configure-wrappers/configure-cvsd
make
sudo /etc/init.d/cvsd stop
sudo make install
sudo /etc/init.d/cvsd start
Additional documentation
http://www.mebsuta.com/cvs.htm - short intro (there are many on the web)
http://www.cvshome.org/docs/manual/ - official manual
http://cvsbook.red-bean.com/cvsbook.html - Open Source Development with CVS
by Karl Fogel and Moshe Bar, a
free CVS book
to top