This post briefly shows how to get cvs running on a remote server and access it in two different ways; as a pserver and over ssh. The main references I used are here:
Setting up CVS at CrazySquirrel
Getting Started with CVS by Dave O'Connor at linux.ie
Connecting to a Remote CVS Server via SSH on a non-standard TCP Port by Sean O'Donnell
As superuser, install cvs on the local and remote machines (sudo apt-get install cvs or equivalent). Then, on the remote server:
# mkdir /usr/local/cvsroot/ # cvs -d /usr/local/cvsroot init
This section assumes you're using xinetd; the setup is slightly different if you're using inetd instead.
Make sure there's a file /etc/xinetd.d/cvs on the remote server with the following contents:
service cvspserver
{
disable = no
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
passenv = PATH
server = /usr/bin/cvs
env = HOME=/usr/local/cvsroot
server_args = -f --allow-root=/usr/local/cvsroot pserver
}
If you needed to create or edit that file, restart the xinetd server:
# /etc/init.d/xinetd restart
From the local machine, verify you can log in via pserver. On first login, a new /home/username/.cvspass file will be created on the local machine allowing future password-less logins:
me@local:/home/me$ cvs -d :pserver:user@servername:/usr/local/cvsroot login Logging in to :pserver:user@servername:2401/usr/local/cvsroot CVS password: cvs login: CVS password file /home/dan/.cvspass does not exist - creating a new file me@local:/home/me$
So you can log in, but at this point you don't have permissions to check things out because the cvsroot directory belongs to root. On the remote server, create a new user and group named cvs, and add your usual login username (below it appears as "user") to the group:
# /usr/sbin/groupadd cvs # /usr/sbin/useradd -g cvs cvs # /usr/sbin/usermod -a -G cvs user # chgrp cvs /usr/local/cvsroot # chown cvs /usr/local/cvsroot # chmod 775 /usr/local/cvsroot
From the local machine, try to check out files:
me@local:/home/me/tmp$ cvs -d :pserver:user@servername:/usr/local/cvsroot checkout CVSROOT cvs checkout: Updating CVSROOT U CVSROOT/checkoutlist U CVSROOT/commitinfo U CVSROOT/config U CVSROOT/cvswrappers U CVSROOT/editinfo U CVSROOT/loginfo U CVSROOT/modules U CVSROOT/notify U CVSROOT/rcsinfo U CVSROOT/taginfo U CVSROOT/verifymsg me@local:/home/me/tmp$
Add the following to /etc/profile on the remote server, in case you ever want to use cvs from a shell over there:
#CVS CVSROOT=/usr/local/cvsroot export CVSROOT
And on the local machine:
CVSROOT=:pserver:user@servername:/usr/local/cvsroot CVSEDITOR=emacs export CVSROOT CVSEDITOR
For those changes to /etc/profile to be effective, log out and then back in.
For a more secure method of using cvs, disable the cvs pserver by setting disable = yes in /etc/xinetd.d/cvs and use ssh instead:
Changes to /etc/profile on local machine:
CVS_RSH='/usr/bin/ssh' CVSROOT=:ext:user@servername:/usr/local/cvsroot CVSEDITOR=emacs export CVS_RSH CVSROOT CVSEDITOR
If your remote server uses a non-standard port for SSH (and it should!), add the following to ~/.ssh/config
Host servername Port 666
So now you have access to cvs on the remote server. To import an exising project (called a module in cvs), go to its base directory and do this:
me@local:/home/me/tmp$ cvs import modulename companyname START
To check out that project:
me@local:/home/me/tmp$ cvs checkout modulename
There's a brief list of useful commands near the bottom of the Getting Started with CVS by Dave O'Connor at linux.ie.