Linux/Articles/CVS/pserver setup

» Home
» Publications
» Profile(CV)
» Contact

» Money
» Consulting

» Java.SCJP
» Java.Links
» Oracle.OCA
» Oracle.OCP
» Linux.Certification
» Linux.Articles
» Process.Agile

» Microcontroller
» Album
» Dictionary
» Impressum



» Creating a cvs repository with pserver authentication


 Step 1
Decide a cvs repository location (I use /usr/local/cvsroot) and set your CVSROOT variable. It is a good idea to set this in a bash startup file e.g. /etc/profile
export CVSROOT=/usr/local/cvsroot

 Step 2
be root and create a group and add as much users as you require.
[root@hermes dev]#/usr/sbin/groupadd cvsgrp
[root@hermes dev]#/usr/sbin/useradd -c "User Name" -g cvsgrp username
[root@hermes dev]#passwd username

 Step 3
You have two options. You can move your existing repository from a windows cvs server or you can create a new repository.

 Step 3.1
If your are moving an existing repository from a windows server set the file and directory permissions Your repository (/usr/local/cvsroot) should look like this
total 1
drwxrwxr-x    3 kguclu   cvsgrp 2003-05-24 19:25 CVSROOT
drwxrwxr-x    3 kguclu   cvsgrp 2003-05-24 19:27 project
and the files under project directory looks like this
total 16
-r--r--r--    1 kguclu  cvsgrp 2003-05-24 19:27 book2menu.xsl,v
-r--r--r--    1 kguclu  cvsgrp 2003-05-24 19:27 document2html.xsl,v
-r--r--r--    1 kguclu  cvsgrp 2003-05-24 19:27 site2xhtml.xsl,v
-r--r--r--    1 kguclu  cvsgrp 2003-05-24 19:27 tab2menu.xsl,v
drwxrwxr-x    2 kguclu  cvsgrp 2003-05-24 19:27 test
This gives necessary information about the directory permissions. If you are moving your files from a windows file system you need to set the permissions manually you can search for directories by using the following command under CVSROOT
find . -type f | xargs ls -l
this will give you the files and its permissions. There is an example below
-r--r--r--    1 kguclu   cvsgrp 2003-05-24 21:55 ./project/file1,v
-r--r--r--    1 kguclu   cvsgrp 2003-05-24 21:55 ./project/file2,v
-r--r--r--    1 cvs      cvsgrp 2003-05-24 20:59 ./project/file3,v
-r--r--r--    1 cvs      cvsgrp 2003-05-24 20:59 ./project/file4,v
-r--r--r--    1 cvs      cvsgrp 2003-05-24 21:33 ./project/file5,v
-r--r--r--    1 cvs      cvsgrp 2003-05-24 21:36 ./project/test/file1,v
-r--r--r--    1 cvs      cvsgrp 2003-05-24 21:36 ./project/test/file2,v
-r--r--r--    1 cvs      cvsgrp 2003-05-24 21:36 ./project/test/file3,v
-r--r--r--    1 kguclu   cvsgrp 2003-05-24 21:57 ./project/test1/file1,v
so if your stucture doesnot look like the same you should change them appropriately but there are some files under CVSROOT directory which has different permissions for that reas cvs guide "http://www.cvshome.org/docs/manual/cvs_2.html#SEC13"
If your repository has different permissions use the following commands in order to set the right permissions use
find . -type d | xargs chmod 775
to set the directory permissions and use
find . -type f | xargs chmod 444
to set the file permissions

 Step 3.2
If you are starting up a new project simply use the following to create a new repository from scratch.
cvs -d /usr/local/cvsroot init

 Step 4
To inherit the parent directory permission to the newly created sub dirs use chmod g+s to set the SGID bit of the directory. use the following command to set the SGUID bit of sub directories
find . -type d  | xargs chmod g+s

 Step 5
Make sure /etc/services contains the line
cvspserver 2401/tcp

 Step 6
Depending on your linux distribution you can may need to edit different configuration files. If your system has /etc/inetd.conf edit that file add the following line (only one line) and restart inetd by "killall -HUP inetd"
cvspserver stream tcp nowait root /usr/bin/cvs cvs 
   --allow-root=/usr/local/cvsroot pserver
if you donot have /etc/inetd.conf this means that your linux distribution uses xinet.d create /etc/xinet.d/cvspserver file and Inside that file paste the following and restart your xinetd:
service cvspserver
{
  disable     = no
  protocol    = tcp
  socket_type = stream
  wait        = no
  user        = root
  server      = /usr/bin/cvs
  server_args = -f --allow-root=/usr/local/cvsroot pserver
  passenv     =
  groups      = yes
}

 Step 7
If you skip or forget that step you get the following message
cvs server: failed to obtain dir lock in repository /usr/local/cvsroot
In order to fix this problem edit CVSROOT/config and add the following
LockDir=/var/lock/cvs
create a cvs lock directory and set the permission of the directory, allow write access to the group members
mkdir /var/lock/cvs
chgrp -R cvsgrp /var/lock/cvs
chmod -R g+w /var/lock/cvs

 Step 8
To test, go to your home directory and enter:
cvs -d :pserver:cvs@tiger:/cvs login
cvs -d :pserver:cvs@tiger:/cvs co .

Copyright © 2002 by Koray Güclü.