You are on page 1of 3

: CVS Installation:

a. Installation

i. Download CVS

The latest version of CVS can be obtained from www.cvshome.org.

ii. Compilation and Installation

To compile and install from source, untar the package into a directory. Then,
from within that directory, configure, make, and make install.

iii. Create Users and Groups

Create a user called cvs:

# useradd -M -s /sbin/nologin cvs

On Linux, this should automatically create a group called cvs. If that group
was not created, manually create the cvs group:

# groupadd cvs

Next, create an anonymous user:

# useradd -M -s /sbin/nologin anonymous

Edit the /etc/group file to add other users to the cvs group (including the
anonymous user).

cvs:x:501:sandy,tom,billy,anonymous

iv. Configure xinetd

As the root user, create a file called /etc/xinetd.d/cvspserver:

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

NOTE: be sure to change the "allow-root" value to the correct path of the CVS
repository (which is created in the next section).

Restart the xinet daemon:

# service xinetd restart

b. Configuration
i. Create Directories

As the root user, decide where the CVS files will be stored and set the
environment variable CVSROOT to that location:

# export CVSROOT=/usr/local/cvsroot/

Make sure that the path chosen matches the path indicated in the
/etc/xinetd.d/cvspserver file, or that a symbolic link is created to point one to
the other.

Next, create the CVS root directory and change the ownership and permissions:

# mkdir $CVSROOT
# chown -R cvs:cvs $CVSROOT
# chmod ug+rwx $CVSROOT
# chmod o-rwx $CVSROOT
# chmod u+s $CVSROOT
# ln -s $CVSROOT /cvs

ii. Initialize Repository

Login as one of the users in the CVS group. Set the CVSROOT environment
variable to equal the CVS root directory (as specified in the previous step). Run
the following command:

$ export CVSROOT=/usr/local/cvsroot/
$ cvs init

This command will exit silently but should have created a directory called
CVSROOT inside your CVS root directory (in other words $CVSROOT/CVSROOT).

iii. Add Users

While CVS can use the system /etc/passwd file to authenticate users, this is
not recommended. Create a file $CVSROOT/CVSROOT/passwd with the format:

username:crypt_password:run_as_user

Since only the cvs group can access the repository (as per our file
permissions), all users should run as the cvs users once authenticated. In more
advanced configurations, you can use several different usernames to further limit
which modules can and cannot be accessed. This will not be covered by this
document.

For the anonymous user, the password can be left blank. For the other users,
use a crypt tool to create a encrypted password (for instance, try htpasswd -n).

Here is a sample $CVSROOT/CVSROOT/passwd file:

sally:$1$E7W5p/WI3ASSEDQIU.hi16m0:cvs
tom:$1$xbtEICBf$xssx8Yds4njDT6/:cvs
billy:$1$.cUuopYjkCtK0kqCZrsceEY1:cvs
anonymous::cvs
Next, to limit the anonymous user to read-only access, create a file called
$CVSROOT/CVSROOT/readers with only the following line:

anonymous

C. How to put a project under CVS

A simple program consisting of multiple files is in /class/bfennema/project.

To put this program under cvs first

cd to /class/bfennema/project

Next

cvs import -m "Sample Program" project sample start

CVS should respond with


N project/Makefile
N project/main.c
N project/bar.c
N project/foo.c

No conflicts created by this import

If your were importing your own program, you could now delete the original source.
(Of course, keeping a backup is always a good idea)

You might also like