How-To

CentOS: Installing a CVS Server

Concurrent Versioning System (CVS) aids team members share codes and files very effectively, and tracks the changes made to any file. Its development has not been very active for the past few years, but many still see the benefits of such a sharing system.

There are several free central repository or file sharing systems these days, like GitHub (but your codes will be on public display in GitHub unless you pay for it) and Google Drive. But for privacy reasons, I think many developers prefer to share codes on their own server and synchronise within their control.

Apache Subversion (SVN) also performs very similarly to CVS, and seems to be in active development, so maybe I’ll write about it some time.

Cut to the chase, here is how to install CVS on your CentOS server:

  1. Install CVS using yum:
    yum install cvs
  2. If xinetd isn’t installed, install it too:
    yum install xinetd
  3. It is good practice to create a group for users that are going to access CVS on your server:
    groupadd cvs
  4. Add a user to your new group, cvs.
    • New user: useradd -G cvs luvelle.
      Then add a password: passwd luvelle
    • Existing user: usermod -a -G cvs luvelle
  5. Your user should now be in the cvs group:
    groups cvs
  6. Decide where you’d like to store your files that will be synchronised by CVS, and create the directory, e.g. in /home/cvsroot:
    mkdir /home/cvsroot
  7. Initialise that directory using CVS:
    cvs -d /home/cvsroot init
  8. Restrict access to your configuration file in CVSROOT:
    chmod 644 /home/cvsroot/CVSROOT/config
  9. Create a file in /etc/xinetd.d if it doesn’t exist for your CVS service:
    vi /etc/xinetd.d/cvs
    Type in the following:

    service cvspserver
    {
    disable = no
    socket_type = stream
    wait = no
    user = root
    group = cvs
    log_type = FILE /var/log/cvspserver
    protocol = tcp
    env = '$HOME=/home/cvsroot' # change if your directory is different
    bind = 192.168.0.1 # change this to your server IP address
    log_on_failure += USERID
    port = 2401 # make sure your port is open
    server = /usr/bin/cvs
    server_args = -f --allow-root=/home/cvsroot pserver
    }

  10. Make sure CVS is a service in /etc/services:
    vi /etc/services
    Add the following lines if they are not inside:
    cvspserver 2401/tcp
    cvspserver 2401/udp
  11. Restart xinetd:
    service xinetd restart
  12. Check if cvspserver has started:
    ss -l | grep cvspserver
    You should see this: tcp LISTEN 0 0 <your-ip-address>:cvspserver *:*
  13. If you’d like to let your users use the same password to log into CVS, copy the password file:
    cp /etc/shadow /home/cvsroot/CVSROOT/passwd
    Then change its access rights:
    chmod 644 /home/cvsroot/CVSROOT/passwd
    Modify the file by deleting all lines except those you expect to access CVS on your server.
    For the remaining lines, delete everything after the second “:”, and add “cvsroot”, so that it looks like this:
    luvelle:blahblahblahthis.is.where.your.hashed.password.lies.123:cvsroot

Now you’re almost good to go!

On your client end, you may download a client with a UI (SmartCVS is a good choice), or install CVS on your machine and use command line in your machine.


Suppose you picked the latter, after installing CVS, you may add the following export statement into your .bash_profile file, or simply enter into your terminal:
export CVSROOT=:pserver:luvelle@:/home/cvsroot
The former method makes it “permanent”, as you do not have to re-enter it after you close your terminal, so some of you may prefer saving it into your profile if you are going to be active on CVS.

Try logging in:
cvs login

Or importing something:
cvs import -m "I am testing CVS" your-checkout-folder your-project-name start


A quick search on Google will give you all the necessary commands you need to carry out the tasks you need to do on CVS.


1 thought on “CentOS: Installing a CVS Server

Leave a Reply

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