I searched Google for a few hours on how to set up a CVS server that I could use remotely. Lots of good stuf...if it worked for me. Turns out it's a lot easier than every article says. So this is a very brief guide on setting up a cvs server that you can access remotely.
There are a few different methods of using CVS remotely, the two that I know of are setting up a pserver and using CVS via SSH. A pserver has proven to be more difficult to set up, and isn't as secure, because none of the transmitted data is encrypted. I like security, so this is about using it with SSH. It's easier anyway, and as far as I can tell, is the preferred method.
First make sure you have cvs installed. Type 'cvs' (no quotes) at the command line, and if you get something other than "command not found" you're good to go.
The first thing you have to do is create your cvs repository. This is where all the stuff that you want managed by CVS goes. Anything will do, I use /usr/local/cvsrep. So you've got:
bash-2.05a$ cd /usr/local
bash-2.05a$ mkdir cvsrep
Next thing you have to do is set the CVSROOT environment variable to make things easy on you. It's different if you're doing it in bash or tcsh (default on OS X). I like bash, so that's what I use. Anyway, here's how you do it
bash-2.05a$ export CVSROOT=/usr/local/cvsrep
tcsh is (I don't know what the tcsh prompt looks like):
prompt: set CVSROOT "/usr/local/cvsrep"
Now you need to initialize CVS. It's really simple:
The next thing you need to do is actually create your project. Make sure you're in $CVSROOT, and create the directory you want a CVS project to go in:
bash-2.05a$ mkdir myproject
Now all that's left is to import the project into CVS. You do this by switching into the project directory and issuing the import command:
bash-2.05a$ cd myproject
bash-2.05a$ import myproject
And there you have it, you've just set up a CVS server. This can be played around with locally, type "man cvs" at the prompt to see what you can do with it.
Now all that's left is to use it remotely. Well that's no trouble at all. Because it uses SSH, you MUST have an account on the remote machine (cvs server). Otherwise it won't work. So what we do is ensure that the cvs command uses ssh as the shell, and run cvs to get everything. This must all be executed on the host machine.
bash-2.05a$ export CVS_RSH=ssh
bash-2.05a$ cvs -d :ext:username@host:/usr/local/cvsrep checkout myproject
That checks out the code from the CVS repository. We haven't actually committed anything yet, so it really doesn't do any good. All you need to do to commit a project is run the commit command with CVS.
So that's it, CVS server all set up, and you can connect to it remotely and securely. Enjoy.
For further reading, including the comprehensive use of CVS, check out the CVS Manual