Setup a CVS Server (pserver) on CentOS 7

Warning

This document is considered archived and is most likely no longer relevant in modern day environments.

The following steps can be used to install a CVS server on CentOS 7. It is assumed you have a CentOS 7 system installed, updated (sudo yum update) and running.

Hopefully you are here for testing/legacy support for a project/task since there is at least one (1) or more better revision control software’s out there.

Prerequisites

  • System with CentOS 7 Installed

Steps

Install required modules:

$ sudo yum install cvs xinetd

(if you have selinux enforcing)
$ sudo yum install policycoreutils-python

Create a CVS user:

$ sudo useradd cvs

Make a CVS root folder (the base for you CVS modules):

$ sudo mkdir /opt/cvsroot

Initialize your CVS directory:

$ sudo cvs -d /opt/cvsroot init

Adjust permissions for your CVS content:

$ sudo chown -R :cvs /opt/cvsroot
$ sudo chmod -R g+ws /opt/cvsroot

(if you have selinux enforcing)
$ semanage fcontext -a -t cvs_data_t '/opt/cvsroot(/.*)?'
$ restorecon -R -v /opt/cvsroot

Build your CVS pserver service:

$ sudo bash -c 'cat >> /etc/xinetd.d/cvspserver << "EOF"
service cvspserver
{
    port        = 2401
    socket_type = stream
    protocol    = tcp
    wait        = no
    user        = root
    passenv     = PATH
    server      = /usr/bin/cvs
    server_args = -f --allow-root=/opt/cvsroot pserver
}
EOF'

Start up your CVS pserver service:

$ sudo systemctl restart xinetd.service

Add firewall bypass (if your firewall is enabled):

$ sudo firewall-cmd --zone=public --add-port=2401/tcp --permanent
$ sudo firewall-cmd --reload

Add desired users to the CVS group for access:

$ sudo usermod -a -G cvs <user>

With these steps your server should be up and working. An example on how to checkout the base and import your first CVS module from a client is as follows:

$ export CVSROOT=:pserver:<user>@<server>:/opt/cvsroot
$ SET CVSROOT=:pserver:<user>@<server>:/opt/cvsroot
$ cvs login
$ cvs checkout .

$ mkdir <new_module>
$ cd <new_module>
$ cvs import -m "Initial message." <new_module> <company> start