Nov 25, 2009

Howto install CVS/CVSNT server on RHEL/CentOS


First you'll have to check /etc/services for the definitions of the CVS used TCP ports :




grep -i cvs /etc/services
cvspserver 2401/tcp # CVS client/server operations
cvspserver 2401/udp # CVS client/server operations

Then you'll have to install either CVS package either CVSNT package :
yum install cvs
or
rpm -ivh cvsnt-2.5.04.3510-rh9-rpm.tar.gz

Now, set up users that will access the CVS server :
vim /etc/passwd
vim /etc/shadow

Then, setup a folder for the CVS data. I usually put this on an NFS share which is on a filer so that data is backuped and you have snapshots of it :
mkdir /home/cvsrepo
cvs -d /home/cvsrepo init
chgrp GID /home/cvsrepo (according to what you did in the /etc/passwd)
chmod g+w /home/cvsrepo

Now add the CVSROOT environement variable to all the users needed :

echo "export CVSROOT=/home/cvsrepo" >> /root/.bashrc
echo "export CVSROOT=/home/cvsrepo" >> /home/userXXX/.bashrc

Now time for setup the CVS server. It will be launched by Xinetd, so check you have it running on your system. It is running default on CentOS5, RHEL5, Suse, ...
/etc/init.d/xinetd status
It's Xinetd who will launch CVS each time a client is asking. This is configured in the /etc/xinetd.d folder; you'll have to add a file like this one :
cat /etc/xinetd.d/cvspserver
service cvspserver
{
disable = no
socket_type = stream
wait = no
user = root
group = systeme
log_type = FILE /var/log/cvspserver
protocol = tcp
env = '$HOME=/usr/local/cvspserver'
log_on_failure += USERID
port = 2401
server = /usr/bin/cvs
server_args = -f --allow-root=/home/cvsrepo pserver
}


Now restart you xinetd, and check you /var/log/messages that your new rule cvspserver has been loaded :
/etc/init.d/xinetd restart
cat /var/log/messages

Everything is now ok, your CVS server is up. Supposing you created a user named 'user1' on the cvs server named 'cvsserver' here is the CVSROOT you'll have to use either on UNIX systems, either on Windows with TortoiseCVS or another CVs client :
CVSROOT=:pserver:user1@cvsserver:/home/cvsrepo
For security reasons, it's possible to create CVS ONLY users. For that, go to the CVS folder and CVSROOT then. At this place there is a "CVS local passwd" alose named passwd. To add users able only to access the CVS and no the entire system, use htpasswd command or perl scripts :
htpasswd passwd user3

Have fun !

1 comment:

adrian said...

That script just fried my VM. I tried to resize it to half the size of my physical disk, but that failed because the script dds everything out and back in again, including all the unused blocks. There's no need for this - ext3 can resize in place, but it should at least look for the hole it's about to walk into. It got nearly to the end and said "ouch - try e2fsck" but by this time the physical machine was also crippled with the huge dd file.