Tuesday, March 01, 2005

CVS Setup

1) First we need to create enviornment variable called CVSROOT and point it to the root of the repository

export CVSROOT=/home/cvsroot

It can have othernames than cvsroot

2) Now we need to initialise the repository with the following command. Be root to do this.

cvc init

3) Next we have to setup files, directories and then define a module.

Suppose I have a directory called "staff/resume" with some files that should be added to CVS.
To import these files go to staff/resume directory and issue this command

cvs import -m "Import Source" staff/resume thestaff start
cvs checkout CVSROOT/modules

Now Alter the modules file in root directory (not repository) and add this
line.

resume staff/resume

Now save the file and issue the command

cvs commit -m "Added resume module." modules

Now this creates our needed file in CVSROOT. Now we can delete the original
staff/resume directory.

One way is to rm -rf staff. But a better and safer way is

cvs release -d staff
4) Now we should give proper unix group and user permission for modules
directory as this determines who can commit changes. It means that modules
directory should be owned by group who has permission to commit change.
Also group must have write permission if they have permission to update CVS.


5) To make the changes you have made locally into the repository use command

cvs commit staff

or to update

cvs update staff

Normally its good to update the cvs and then give command commit.

6) To create login authentication for cvs do the following.
a) Create a /etc/xinetd.d/cvspserver file if it does not exist, and add the
following.

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

Then restart xinetd with /usr/xinetd restart

b) Now create password file in $CVSROOT/CVSROOT/passwd with following content

anonymous:
ullas:$1$75g0K7Vm$ULM55Jj/b6QvVB8RxAlk5/
vikas:@#$$$%7677665566@45667777665555667:ullas
suvas:233$$%7677665566@45667777665555667:ullas

Here password is unix crypt.
Here ullas will have permission if he supplies password. Vikas user can login
with password even if he does not have an account in server and he will run as
ullas in this case. Simalar is the case with Suvas.

c) Now you can login with following command

cvs -d :pserver:anonymous@localhost:/home/cvsroot co staff
or
cvs -d :pserver:ullas:sallut123@localhost:/home/cvsroot co staff

d) You can make this as your CVSROOT enviornment variable in .bash_profile
like the comman below.

CVSROOT=:pserver:ullas:sallut123@localhost:/home/cvsroot co staff

e) To create readonly access to CVS create a file $CVSROOT/CVSROOT/readers
with following contents.

ramesh
sujatha
suvas

Now above three persons becomes read only members of cvs.

No comments: