Thursday, July 23, 2009

How to setup cvs server on Ubuntu

Install cvs and cvsd, start Synaptic Package Manager from ubuntu menu bar
System > Administration > Synaptic Package Manager

typ cvs in Quick Search box, select cvs and cvsd, click Apply.

When installing cvsd, you will be asked to enter Repositories to serve, the default setting is /demo:/myrepos, just accept it and click Forward.

After changes applied, you can close Synaptic Package Manager.

Next, open a Terminal.

Type the command to create /myrepos
#cd /var/lib/cvsd
#sudo mkdir myrepos

Initial /myrepos
#sudo cvs -d /var/lib/cvsd/myrepos init

Modify the file /var/lib/cvsd/myrepos/CVSROOT/config
(May be you have to change the permission to writable)

#sudo gedit /var/lib/cvsd/myrepos/CVSROOT/config
Add the line into it:
SystemAuth=no
PamAuth=no
LockDir=/tmp/myrepos

Save and Exit editor

Create LockDir
#sudo mkdir /var/lib/cvsd/tmp/myrepos

Add a user, named cvsuser
#sudo cvsd-passwd /var/lib/cvsd/myrepos cvsuser
You will be ask to input password.

Modify /etc/cvsd/cvsd.conf
#sudo gedit /etc/cvsd/cvsd.conf

Scroll to end of the file, find the text
Listen * 2401
Repos /demo
Repos /myrepos

change to
Listen 127.0.0.1 2401
Repos /demo
Repos /myrepos

where 127.0.0.1 is my local static IP, 2401 is the default port used by cvs.

and then, set the right.
#sudo chown cvsd:cvsd /var/lib/cvsd -R

Restart cvsd
#sudo /etc/init.d/cvsd restart

You can check the cvsd status using the command, and make sure it's running.
#sudo /etc/init.d/cvsd status