BACK
Setting up a Concurrent Versions System
This page will cover setting up a Concurrent Versions System (CVS) on a Linux server. CVS comes standard with practically
every modern Linux/Unix distribution. The Linux distribution being used in this example is SuSE 7.2, but any distribution with
CVS will work.
To begin with, a explanation of what CVS would probably be helpful to those unfamiliar with it. CVS is a document management
system that allows simultaneous editing of copies of the same documents and merging all the changes into one master copy.
This system is very useful to a group of software developers that are working on the same project. With CVS, these
programmers can all submit changes to the software and have them merged into a master copy in the repository. Furthermore
changes can be tracked and releases can be made based on a specified version.
In learning how to setup and use CVS, the book Open Source Development with CVS by Fogel and Bar (2001) was very useful.
I mention this book because I am using it as a guide for writing this very basic HowTo and it or a source similar to it should be
consulted for a more in depth discussion of CVS.
The CVS commands available on CVS equipped system can be used to gain client access to remote repositories. Hosting a CVS
repository, on the other hand, requires a few steps to set it and the server up.
- The first step is to set up the repository; this step can be accomplished with the following command:
# cvs -d /path/to/repository init
The /path/to/repository is going to be the source directory for the repository and will be a
directory that you have write access to. If your user doesn't have write access, root user access will be needed.
It will be needed not just in this step, but in future steps as well (for restarting processes, modifying passwd file, and so on).
Next will be to add a new cvs group and make it the owner group and change the permissions of the directory specified in the
/path/to/repository statement above. The commands to perform these tasks are as follows:
# groupadd cvs
# cd /path/to/repository
# chgrp -R cvs .
# chmod ug+rwx . CVSROOT
The next step will be to set up the cvs server daemon. The daemon is monitored by the inetd daemon. To ensure
that the cvs daemon is enabled, three things need to occur: first,the /etc/services file needs to be edited to verify a line for
cvspserver exists; second, the inetd.conf file needs to be edited to ensure that the cvspserver is enabled; and third, inetd needs
to be restarted. These steps also ensure that a password authentication server is running to allow authenticated log ins to
the CVS server.
Edit /etc/services and make sure the following line exists, you may have to scroll down a lot as the port numbers are normally
in sequential order.
cvspserver 2401/tcp
Now open the /etc/inetd.conf file and verify that the line for cvspserver is uncommented or added if necessary. The line
should look like the following (but will be on one line) if your system uses tcpwrappers (if you aren't sure, look for other entries with
"/usr/sbin/tcpd" in it else use the second option):
cvspserver stream tcp nowait root /usr/sbin/tcpd /usr/bin/cvs \
-f --allow-root=/path/to/repository pserver
The line should look like the following (again, it will be on one line) if tcpwrappers aren't enabled on your system:
cvspserver stream tcp nowait root /usr/bin/cvs -f \
--allow-root=/path/to/repository pserver
If the files have been inspected and have the correct entries, the inetd daemon needs to be restarted. If you are unsure
of how to do this, you can always reboot your system, else try the following commands to get the process ID and restart the daemon:
# ps x | grep inetd
574 ? S 0:00 /usr/sbin/inetd
# kill -HUP 574
The last step in setting up the CVS server is to set up the passwd file to use for authenticating users. To set up the
passwd file, navigate to the repository you specified earlier (/path/to/repository) and create a
new blank file called passwd in the CVSROOT directory. This file will contain user names and passwords in a format similar to
the /etc/passwd file (or /etc/shadow if shadowed passwords are used). The format of the user name/password pairs will be as
follows:
USERNAME:ENCRYPTED_PASSWORD:OPTIONAL_SYSTEM_USERNAME
The USERNAME and ENCRYPTED_PASSWORD will be used to log in to the CVS server, while the OPTIONAL_SYSTEM_USERNAME will be have to be
an actual user with appropriate rights to work in the repository. This optional user name is only needed if the USERNAME is
not an actual user on the system. The encrypted password is obtained in the following manner (you will need root user access):
Change to the root user (will need root's password)
#su root
Set the password for the CVS user. I previously added a temporary user to /etc/passwd -this user can't log in, the
account is just used for getting encrypted passwords. Add the user with the useradd command and set the user's shell
to /bin/false so the account can't be used to log in. The following shows how to create a temporary user and set the
password for this temporary user and get the password (encrypted password is in red on last line, or in between the first and
second colon ":") for use in the CVS passwd file:
# useradd -s /bin/false tmpuser
# passwd tmpuser
New password: (Enter password for CVS user)
Re-enter new password: (Re-enter password for CVS user)
Password changed
# cat /etc/shadow | grep tmpuser
tmpuser:9/rDrLBReEkN.:11953:0:99999:7:0::
The encrypted password was found in /etc/shadow as my system uses shadowed passwords; if the line with the cat and grep commands
doesn't work, try replacing shadow with passwd. Skipping the useradd command, this process can be repeated for getting
encrypted passwords to fill the user list in the CVSROOT/passwd file.
Now the user name and corresponding password can be entered into the passwd file in the CVSROOT/ directory of the repository.
The following shows a new user's entry in the passwd file (The admin user is an actual account on the system, but will
have a different password for CVS than for system log in.):
admin:9/rDrLBReEkN.
Now the repository and server have been set up and a user has been added so he or she can log in to the system and use all the
capabilities of CVS to manage their projects. To see how to interact with CVS, see this page on
CVS use.
- Fogel, Karl and Moshe Bar. 2001. Open Source Development with CVS. 2nd ed.
Scottsdale, AZ: The Coriolis Group, LLC.
BACK |