When you have more than one person working on a project you need to make sure that they don’t overwrite each others changes. When you only have a few directories then Revision Control System (RCS) is fine. But when you have dozens of projects with ten programmers and your development environment is spread over several boxes, you have a project management nightmare that RCS is just not up to handling.
What you need is Concurent Version System (CVS). CVS is great because it is network aware, works with entire directory trees and allows multiple people to work on the same file at the same time without loosing anyones changes. CVS is already installed in Redhat 6.0+.
As great as CVS is it still allows your source code to go across the internet without encrypting it. This month I am going to talk about setting up a secure networked repository using Secure Shell (ssh). Next month I will show you how to import your current projects into the repository, how to check your code out, update files and check your code back into the repository.
- Setup ssh on all of your boxes. This program is available here. The company that makes ssh can be found here.
- Setup sshd to run on the machine that will host the repository.
- Create a new user account for each group of programmers on the machine that is hosting the repository account. For this example create a new user called repository.
- Create a .ssh directory on everyone ones accounts, including the new repository accounts.
- Run ‘chmod 700 .ssh’ as the owner of the home directory on everyones account, including the repository accounts.
- Have everyone create a public and private key using ssh-keygen.
- Collect everyones ~/.ssh/identity.pub files and place these into the ~/.ssh/authorized_keys in the repository account if they are allowed to work on that project.
- Run ‘chmod 700 ~/.ssh/authorized_keys’ as the repository account.
- Test to make sure that people can use ‘ssh repository@repository_host’ where repository is the name of the group directory and repository host is the name of the host that has the repository.
- Create a directory called ~/cvsroot in the repository home directory.
- Setup the followint two environmental variables in whatever shell script rc file you need to. For me it was my ~/.bashrc file:
export CVS_RSH=ssh export CVSROOT=repository@repository_home:/home/repository/cvsroot
- Login to another window to ensure that you still can login and that these environmental variables got set correctly.
- Do a ‘cvs init’ command as any user authorized to use this repository and you should get no error messages.
- If you get any error messages, start over from scratch and repeat directions until you get it works.
- If you have any questions please contact me.
- Take this oportunity to play with both SSH and CVS. Read the documentation, see if you can think up of new ways of using them. If anyone has another way of setting up cvs repositories, please share with us! I am especially interested in finding out how to setup a public cvs repository like I see on the internet all the time.
And if anyone was paying attention, this is also how you can setup all of your own accounts so that you only have to log on once to a secure machine and then connect to anyother machine without logging in again. I will discuss how to set that up in my next article in this series.
Copyright © 2000, James M. Rogers
Published in Issue 50 of Linux Gazette, February 2000