Install CVS Server on SUSE 11

Warning

This entry was written more than 1 year ago. Please read the article keeping in mind its age.

This tutorial show how to install the CVS version control system on SUSE 11.

What is CVS

This is an explanation picked up from the Wikipedia:

"The Concurrent Versions System (CVS), also known as the Concurrent Versioning System, is a client-server free software revision control system in the field of software development. Version control system software keeps track of all work and all changes in a set of files, and allows several developers (potentially widely separated in space and time) to collaborate. Dick Grune developed CVS as a series of shell scripts in July 1986."

As you can see from the last sentence we can consider CVS like the grandfather of the version control systems, and it still used by developers, but if you are just starting now versioning your projects I strongly suggest to have a look at Git and a great place to learn it is GitHub.

Preliminary Note

Before to start I just want to warn you that this is a practical guide without any warranty, it was written with the purpose to help system administrators, so I won't explain technical details neither the theory behind of them.

Requirements

I used a Suse server in this tutorial to install CVS, so you will need a Suse server installed.

Have a look to the Suse Linux Enterprise Server 11 SP2 Installation tutorial to install one.

Install CVS on SUSE 11

Login as root user and install the cvs package:

# zypper install cvs
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW package is going to be installed:
  cvs

1 new package to install.
Overall download size: 386.0 KiB. After the operation, additional 899.0 KiB will be used.
Continue? [y/n/?] (y):
Retrieving package cvs-1.12.12-144.21.x86_64 (1/1), 386.0 KiB (899.0 KiB unpacked)
Installing: cvs-1.12.12-144.21 [done]
#

CVS Configuration

Create a user and a group called cvs:

# groupadd cvs
# useradd -gcvs cvs

Set the repository in the /srv/cvsroot directory:

# cvs -d /srv/cvsroot init

Repeat this process if you want to create multiple repositories, e.g., /srv/cvsroot2, /srv/cvspublic, etc. Each repository can have different sets of authorized users.

Change owner and group of all files of the repository to cvs:

# chown -R cvs.cvs /srv/cvsroot

Configure xinetd to run the cvs service by editing the /etc/xinetd.d/cvs file:

# CVS pserver (remote acces to your CVS repositories)
# Please read the section on security and passwords in the CVS manual,
# before you enable this.
# default: off

service cvspserver
{
    disable         = no
    socket_type     = stream
    protocol        = tcp
    port            = 2401
    wait            = no
    user            = root
    server          = /usr/bin/cvs
    server_args     = -f --allow-root=/srv/cvsroot pserver
}

Now restart xinetd:

# /etc/init.d/xinetd restart
Shutting down xinetd: (not running)         done
Starting INET services. (xinetd)            done
#

CVS Repository Testing

Login as root and add yourusername to the cvs group:

# usermod -G cvs yourusername

Login as yourusername and set the default repository in the environment

> export CVSROOT=:pserver:yourusername@localhost:/srv/cvsroot

Test the basic login:

> cvs login

Enter the yourusername password. There should not be any error messages.

If you get an error like this:

cvs login: warning: failed to open /home/yourusername/.cvspass for reading: No such file or directory

you can easily fix it by changing the file permissions:

> chmod 660 .cvspass

Create a tiny test project:

> cd
> mkdir testproject
> echo "Testing CVS Server" > testproject/README.txt

Now import the project to the repository:

> cd testproject
> cvs import -m "Imported a test project" testproject mycompany start

Make sure the project was created in the repository.

You should see the file README.txt inside /srv/cvsroot/testproject folder:

> ls -la /srv/cvsroot/testproject/

Remove your test project folder and checkout a working copy:

> cd
> rm -r testproject
> cvs checkout testproject

That's it ! Now you can start versioning your projects with CVS.

Danilo