CVS Server Quick Guide
Introduction
CVS is an abbreviation for the Concurrent Version System for version management. If you have participated in the projects that have collaborated with many people, everyone must have such a painful experience: Since many people have modified the same document, their own hard-modified procedures are completely deleted by others. Also, if your software / program has released three versions, at this time, the user needs you to modify the second version, maybe you will cry because only the latest version is kept. There is also some modifications to the program, but the modifications are very few, you only want to send a different version of the different versions to the distant colleagues, which can be exempted from the mailbox is not big enough, the network speed is too slow. . In order to solve problems like this, and such as generating patch files, historical version modifications, a bunch of hackers (commendation) has developed CVS based on the Mature SCCS and RCS in the original UNIX system. (SCCS: Source Code Control System, RCS: Revision Control System).
The basic work idea of CVS is this: Create a repository on one server, and many source processes of many different items can be stored in the warehouse. The source program is managed by the warehouse administrator. In this way, it seems that only one person is like a file. Avoid conflicts. Each user first uses the warehouse to download the project file in the warehouse to the local. Any modification of the user is first conducted locally, then submitted by the CVS command and is unified by the CVS warehouse administrator. This will do tracking file changes, conflict control, and more.
Since CVS is a typical software software, it is also divided into two parts: the server side and the client. However, most CVS software combines them two. We will discuss the use of CVS from the perspective of servers and clients, respectively.
CVS server installation
First ensure that the system has CVS:
[root @ mail xinetd.d] # rpm -qa | grep cvs
CVS-1.11.1p1-3
If the command output is similar to the above output, the system has been installed with CVS, otherwise the RPM package of the CVS is required from the installation disc.
One creation CVS host user:
# ueradd -d / cvsroot CVS
# chmod 771 / CV SROOT
Second, establish a CVS warehouse (initialization CVS)
# su cvs
$ cvs -d / cvsroot init
$ EXIT
#
Fourth, start the CVS server
Create a file CVSPServer in the /etc/xinetd.d/ directory, the content is as follows:
# Default: ON
# Description: The cvs server sessions;
Service CVSPServer
{
Socket_type = stream
Wait = NO
User = root
Server = / usr / bin / cvs
Server_Args = -f - allowow-root = / cvsroot pserver
LOG_ON_FAILURE = UserID
ONLY_FROM = 192.168.0.0/24
}
The only_from is used to restrict access, and can be not or modified according to the actual situation.
Modify this file permission:
# chmod 644 CVSPSERVER
Then restart xinetd: # /etc/rc.d/init.d/xined restart
Then check that the CVS server has been running:
[root @ mail xinetd.d] # netstat -lnp | GREP 2401
TCP 0 0 0.0.0.0:2401 0.0.0.0:0:0:40:40:17866 / xinetd
The CVS server has been run.
5. Create a user who uses to access CVS
The CVS user created earlier is a CVS warehouse management user, and an access user is required in order to allow users to access:
# UserAdd CVSPUB
# @ usemod -g cvs CVSPUB
A user CVSPUB is added here, and the user is added to the CVS group.
6. Manage CVS servers
Manage CVS servers. The server can be used, and now everyone is most concerned how to manage the server, for example, I want some people to read and / or write the permissions of the CVS warehouse, but don't want to give it system permissions? It is not difficult, after the end of CVS initialization, there is a cvsroot directory in the main directory of the administrator user (here is the CVS user). There are three profiles in this directory: Passwd, Readers, Writers. We can configure the CVS server by setting these three files, and the role of these files is described below:
Passwd: CVS user user list file, its format is very like shadow file:
{CVS User Name}: [Encrypted Password]: [Equivalent System User Name]
If you want a user just a cvs user, not a system user, then you have to set this file, after the installation, this file may not exist, you need to manually create a CVS administrator (Su CVS) user, of course, you have to follow The above format;
The second field is the user's encryption password, which is encrypted with Crypt (3). You can write a program to do encryption, you can also use two lazy ways: first create a system user, name and CVS users. The password is ready to give it a CVS user password. After the creation, copy the user's second field from / etc / shadow, and then remove this user. This method is relatively convenient to deal with fewer users, and people are not suitable, and there is also a safety hazard of conflict conditions, and Root privileges, it is really not good, but the equivalent is another method. That is to use the apche's htpasswd command to create a passwd user, add users only need htpasswd passwd username to add users to the Passwd file, but need to add a final addition to the end in the file ":" colon and corresponding equivalent system username; The best is to write a program to generate this Passwd file.
The third field is an equivalent system username. In fact, it is to assign an equivalent system user with a CVS user. Look at the following example you understand its function.
Readers: A user list file with CVS read rights is a one-dimensional list. Users in this file to CVS
Only read permissions.
Writers: The list of users with CVS write permissions, like Readers, is a one-dimensional list. Users in this file have write access to CVS.
The above three files may not exist when the default installation, you need to create it yourself, ok, now let us use an example to teach. Suppose we have the following users to use CVS:
Cvsuser1, Cvsuser2, Henry, Betty, Anonymous
Where Laser and Gumpwu are system users, and Henry, Betty, Anonymous we don't want to give system user privileges, and Betty and Anonymous are read-only users, and Anonymous is even more than.
Then edit the cvsroot / passwd file in the CVS Administrator's Catalog, add the following line:
Laser: $ xxefajfka; faffa33: CVSPUB
GUMPWU: $ AJFAAL; 323R0OFeeanv: CVSPUB
Henry: $ FAJKDPAIEJE: CVSPUB
Betty: fjkal; ffjieinfn /: cvspub
Anonymous :: CVSPUB
Note: The second field above (separator is :) is a secret text password, you want to use the program or use my dirt.
Edit the readers file, add the following line:
Anonymous
Betty
Edit the Writer file, add the following line:
Lase
gumpwu
Henry
This is OK, you will use several users to log in to test, and you will find everything OK. The principles and instructions in this are not much to say, in fact, very simple, and the concept of system management users.
7. Establish a new CVS project
Generally we have one or more projects so we can use the following steps to generate a new CVS project.
Place a project file in CVS for version control, referred to as import (Import) in CVS terms. It can be seen from the name that you need to work for this before importing.
The basic requirement of the input operation is a "clean" directory structure. "Clean" means that there is no version of the file that is removed (such as compiled and generated files, backup files, etc.). If the project has started for a while, this is very important. In the directory, some are not intended to place them under version control, but I want to put them here. In this case, you have to remove them before entering, and then move back.
Note that CVS thinks that the empty directory does not exist. If you want to add a directory that neither files that don't contain subdirectories, you need to create a dummy file under. It is recommended that you create a file called readme.txt whose content is a brief description of the directory.
Enter the directory of existing projects, such as CVSTest:
$ cd cvstest
Run the command to import the project file into the CVS warehouse:
$ CVS IMPORT -M "this is a cvstest project" cvstest v_0_0_1 start
Note: Import is one of the commands of CVS, indicating an input project file to the CVS warehouse.
The strings behind the -m parameter are description text, describe the project, if the -m parameter is not added, then CVS will automatically run an editor (typically vi, but can change to you like to use the environment variable editor. Editor) Let you enter information, cvstest is the project name (actually a warehouse name, stored in a warehouse named after this name)
v_0_0_1 is the total tag of this branch. No use (or not common)
Start is a markup of the input hierarchy of the IMPORT logo file, no use.
In this way, we have built a CVS warehouse, then we can delete this test item file, test how to get files from the warehouse will be described later.