HOW TO CREATE A CVS SERVER USING RED HAT LINUX 6.1 or 6.2

maccvs example client settings are here.

There seems to be a severe lack of step-by-step instructions on how to setup a CVS server using the Concurent Versions System. The available documentation is sparse and less than complete. I have included a list of the books that are most useful for setting up a CVS server at the bottom of this page. This page does not attempt to explain how to use CVS, there is plenty of documentation already available for using CVS. This page instead is designed to give you step-by-step instructions on how to set up such a server. The instructions here assume youa re using Red Hat Linux 6.1. If you are using a different distribution of Linux, then the procedure may be slightly different than the one listed here. The following procedure assumes you want to use pserver as your authenticatoin method and not one of the other methods such as rsh, ssh, or Kerberos which are more complicated and not covered here. So in a nutshell, here are the steps to follow to get a CVS server up and running. This procedure requires many detailed and tedious steps so take your time and be sure to follow each step exactly:

1) Do a clean install of Red Hat Linux 6.1 - boot from the Red Hat CD and when prompted press return to start the GUI Red Hat installer.

2) When the installer starts, click the "Next" button until you get to the screen which asks you to select the type of install you want to do. Click the "Server" button to select a server install, then click "Next". Fill in any hard disk setup and network setup info as prompted and then let the install finish. When the install is complete, remove the boot media and reboot the computer.Doing a server install will automatically copy the needed CVS files to your server so that you do not need to install them manually.

3) After the machine boots you must edit several files with information needed by CVS. Since Linux by default uses bash, all the examples presented here use that shell also.Feel free to use any text editor you like to edit the files. This setup document assumes you already know how to open files, edit them, and save them in Linux.All examples here use the emacs editor for editing files. All text shown in Courier bold should be entered exactly as shown below, with the exception of replacing items in brackets (<>) with real names or pathnames.

4) First, you need to decide which directory you want to store your CVS repository in. In all of the examples here we will store it in an empty directory we made at the root of the server named "repository". If you don't have this directory on your server, make one at the root by switching the current directory to root and then typing:

mkdir repository

(you might need to be logged in as root in order to do this).

When you perform the following steps, it is best if you are logged in as root or su (superuser). Assuming you have done that, type the following command at the root at the command prompt:

cd etc

and press return.

5) The first step is to add a variable to the profile file in the etc directory which will tell the CVS server where your repository is located. This environment variable is called CVSROOT. So type:

emacs profile

and press return to open the file. Scroll down towards the bottom of the file and insert the following three lines:

CVSROOT=/repository/

export CVSROOT

export EDITOR=emacs

The export EDITOR command is optional and can be omitted. It is mainly used to tell CVS which editor to open when it needs to get a checkin comment. If you will be using a GUI CVS client on Windows or Macintosh, you may omit this line. When finished, save the profile file (Control-x Control-s in emacs) and quit the editor (Control-X Control-c in emacs).

6) Next, you will need to add the following lines to the following files exactly as they are listed below. Where names of your users or directories are to be inserted, those names are indicated by <>. You should replace such instances with the proper names, but the edited files themselves should not have the brackets inserted into them. In other words, the brackets are only shown in this document in order to indicate that a real name is needed in those locations. Also, do not put quotes around any inserted names unless indicated by quotes here.

 

/etc/services -add:

cvspserver 2401/tcp (if not already present)

 

/etc/group -add:

cvs:*:105:<userName1>, <userName2>

(These names should match exactly user names on the system and in /etc/shadow)

 

/etc/inetd.conf - add:

cvspserver stream tcp nowait root /usr/bin/cvs cvs --allow-root=/repository pserver

Be sure to note that this entry does *not* have a trailing slash at the end.

Some Linux systems will require an environment variable to be set thusly:

cvspserver stream tcp nowait root /usr/bin/env env -i /usr/bin/cvs -f --allow-root=/repository pserver

If for some reason on your client system you get errors like "Connection reset by peer", then you can try this alternate line in the same file (instead of the line above):

cvspserver stream tcp nowait root /usr/local/bin/cvs cvs -T/tmp -f --allow-root=/u01/repository pserver

 

7) Next, navigate back to root and type:

cvs -d /repository init

This will create the initial repository in /repository/CVSROOT/

 

8) The next part is a little tricky, but it is not too hard to accomplish. It invloves setting up passwords for the pserver, CVS's own server authentication method. This step assumes that you have already set up user accounts and system passwords for each user you want to have access to the CVS server as well as having entered those users into the /etc/groups file as listed in step 6 above. So assuming that that has been done, cd to the /etc directory and type:

cp shadow /<full repository path>/CVSROOT/passwd

In the /etc directory, there is a file named shadow. This file contains all the real system passwords for the system along with a list of users asscociated with those passwords. CVS's pserver uses a similar password syntax to shadow except that it expects to look for these passwords in a file named passwd in the repository's CVSROOT directory. Executing the above line simply makes a copy of the shadow file from /etc into the repository's directory and renames it to passwd. However, we are not quite done with the passwd file just yet.

 

9) Next, cd to /repository and type:

chgrp -R cvs .

chmod ug+rwx . CVSROOT

This will set the permissions on all the files in CVSROOT to the cvs group.

 

10) Next, cd to /repository/CVSROOT and type:

emacs passwd

This will open the passwd file for editing. When you open it, you will see something like the following:

root:$1$KT4ZOG9O$4M1fgufImqfuj0K/XpuIg1:11061:0:99999:7:-1:-1:134549444

bin:*:11060:0:99999:7:::

daemon:*:11060:0:99999:7:::

adm:*:11060:0:99999:7:::

lp:*:11060:0:99999:7:::

sync:*:11060:0:99999:7:::

shutdown:*:11060:0:99999:7:::

halt:*:11060:0:99999:7:::

mail:*:11060:0:99999:7:::

news:*:11060:0:99999:7:::

uucp:*:11060:0:99999:7:::

operator:*:11060:0:99999:7:::

games:*:11060:0:99999:7:::

gopher:*:11060:0:99999:7:::

ftp:*:11060:0:99999:7:::

nobody:*:11060:0:99999:7:::

xfs:!!:11060:0:99999:7:::

gdm:!!:11060:0:99999:7:::

<user1>:$1$jgwa/Nrr$IsCBi.t2.rEx/iSWhsoG5/:11102:0:99999:7:-1:-1:134550548

<user2>:$1$Wlmt1y6J$i8lzVKk1qhm1p9huWtVvz.:11071:0:99999:7:-1:-1:134550500

<user3>:$1$ckd3WoWI$M.q9l8h1q..E8RZbxOPDe.:11103:-1:99999:-1:-1:-1:135464324

.

.

.

Note that the first line of this file and the last few lines have the same format, but the middle part has a different format. In the passwd file only, you want to delete the entire middle block so that you are left with only users at the bottom and root at the top. After such an edit, the file would look like this:

 

root:$1$KT4ZOG9O$4M1fgufImqfuj0K/XpuIg1:11061:0:99999:7:-1:-1:134549444

<user1>:$1$jgwa/Nrr$IsCBi.t2.rEx/iSWhsoG5/:11102:0:99999:7:-1:-1:134550548

<user2>:$1$Wlmt1y6J$i8lzVKk1qhm1p9huWtVvz.:11071:0:99999:7:-1:-1:134550500

<user3>:$1$ckd3WoWI$M.q9l8h1q..E8RZbxOPDe.:11103:-1:99999:-1:-1:-1:135464324

.

.

.

Next, you must delete part of each password since pserver does not use all the password info for each user. Edit each line so that only the text between the first and second colons remains (but leaving the second colon intact). So after the second edit, the file might look like this:

 

root:$1$KT4ZOG9O$4M1fgufImqfuj0K/XpuIg1:

<user1>:$1$jgwa/Nrr$IsCBi.t2.rEx/iSWhsoG5/:

<user2>:$1$Wlmt1y6J$i8lzVKk1qhm1p9huWtVvz.:

<user3>:$1$ckd3WoWI$M.q9l8h1q..E8RZbxOPDe.:

.

.

.

Save the file and exit your text editor. This concludes the editing of the passwd file. DO NOT make these same changes to the /etc/shadow file - it must remian unedited or your system may stop working correctly!

 

11) Next, you must add modules to the CVSROOT so that CVS knows where to put modules when you import or check them in.One very important thing to know is that for each module you want to have on your CVS server, you should have a directory with that name alongside the CVSROOT directory. Open the 'modules' file for editing by typing:

emacs modules

 

At the very end of the file, add a new line and then for each module that you want, type:

<Module name><TAB><Module name>

 

12) Finally you must create an empty dircetory for each of the module names you added in step 9. So cd to the /repository dir and for each module name you added in step 9 type:

 

cd mkdir <Module name1>

cd mkdir <Module name2>

.

.

12.5) Now, you must make each user you added to your etc/group file a member of the default group 'cvs'. To do so, be sure you are logged in as root, and then type:

 

usermod -g cvs <username1>

usermod -g cvs <username2>

.

.

When you are finished with each of your users, reboot your server machine.

 

13) If you want to set watches on all of the files in your repository, edit the CVSROOT/notify file by uncommenting the following line at the bottom of the file:

#ALL mail %s -s "CVS notification"

The "CVS notification" string can be changed to anything you want: it is the text that will be sent as the subject line of all watches email notifications. Be sure to checkout and commit these changes instead of editing them on the server machine directly. For remote users, you will also need to edit the CVSROOT/users file - adding names and emails addresses of those remote users whom you want to send email notification to. The format of the users file is:

CVS_USER:EMAIL_ADDRESS

Example:

john_smith:[email protected]

 

14) If after setting up the server, you get errors like this:

cvs [checkout aborted]: cannot expand modules

It is probably not a modules problem, but rather almost certainly indicates a repository permissions problem. Usually making the directory in question readable using UNIX file permisssions will solve the problem.

 

15) You can turn on a log of all CVS client/server transactions by setting the environment variable CVS_CLIENT_LOG like this:

CVS_CLIENT_LOG=<log_file_name>: export CVS_CLIENT_LOG

 

16) If on a Windows client machine you get errors saying that it can't find the .cvpass file, try adding this line to your autoexec.bat file:

set HOME=C:

 

This completes the setup of the CVS server. You must now reboot the server machine so that the new inetd and groups settings take effect. Reboot the machine and when the machine comes up, you may now log into the machine with a CVS client using the system user names and passwords added to the cvs group and the CVSROOT/passwd file.

You can get a variety of network configuration information about your server by logging in as root or superuser and using the /bin/ifconfig or /sbin/ifconfig command at the command prompt.