Support Package xinetd required for installing CVS
I. Installation
1. Verify whether xinetd and CVs are installed
# Rpm-Q xinetd
# Rpm-Q CVS
If such version information is displayed, it indicates that the version has been installed.
# Xinetd-xx.xx.
# Cvs-xx.xx.
It is usually installed in/usr/bin/CVS. If it is not installed,
Http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/ OS /Fedora/RPMS/
Download the latest RPM installation; installation commands such as: RMP-IVH cvs-1.11.2-10.i386.rpm
You can also use the yum command to install it online.
2. Create a CVS user group and user
Run the following command under the root user:
# Groupadd CVS
# Adduser cvsroot
# Passwd cvsroot
# Enter the cvsroot User Password
3. Create cvsroot
Run the following command under the root user:
# Mkdir/var/cvsroot you can change the cvsroot path you want.
# Chown cvsroot. CVS/var/cvsroot change cvsroot permission
4. initialize CVS
Run the following command under the cvsroot User:
# Su-cvsroot
# CVS-D/var/cvsroot init corresponds to the cvsroot path created above
5. Modify Environment Variables
Edit the. profile file of the corresponding user in/etc/profile or/home.
The/etc/profile has been modified here as an example:
# Exit
Return to the root user. Only the root user has the permission to modify/etc/profile.
# Vi/etc/profile edit the/etc/profile file
Add the following two sentences at the end:
Cvsroot =/var/cvsroot
Export cvsroot
Update environment variables:
Run #./etc/profile. Note that there is a space behind the point
At this time, the system has known environment variables such as $ cvsroot.
Note: If you are prompted that you do not have permission, you must change the profile permission before proceeding to the previous step;
# Chmod 777/etc/profile
6. Start the CVS server:
6.1 modify the CVS configuration file
# Vi/var/CVS/cvsroot/config
Replace "# systemauth = No" with "systemauth = No"
Create the file cvspserver in the/etc/xinetd. d/directory. The content is as follows:
# Default: On
# Description: The CVS server sessions
Service cvspserver
{
Disable = No
Socket_type = stream
Wait = No
User = root
Server =/usr/bin/CVS
Server_args =-f -- allow-root =/var/cvsroot pserver
Log_on_failure + = userid
Only_from = 192.168.0.0/24
}
Here, only_from is used to restrict access and can be modified or not based on the actual situation.
Note: If the path/var/cvsroot is inconsistent with the one created above, or it is/var/cvsroot/, the no such repository problem will occur.
Modify the File Permission:
# Chmod 644 cvspserver
Then restart xinetd:
#/Etc/rc. d/init. d/xinetd restart
Check whether the CVS server is running:
# Netstat-LNP | grep 2401
TCP
0 0 0.0.0.0: 2401 0.0.0.0: * Listen xxxxxx/xinetd or
# Netstat-L | grep cvspserver
TCP 0 0 *: cvspserver *: * listen
The CVS server is running.
Ii. Use Management
There is a cvsroot directory in the home directory of the CVS administrator user (here I am the cvsroot user), which contains three configuration files: passwd, readers, writers, we can configure the CVS server by setting these three files. The following describes the functions of these files:
Passwd: the user list file of the CVS user. Its format is like shadow file:
{CVS username}: [encrypted password]: [equivalent system username]
Readers: list of users with CVS read permission. Is a one-dimensional list. Users in this file have only read permission on CVs.
Writers: List Files of users with CVS write permission. Like readers, it is a one-dimensional list. Users in this file have the write permission on CVs.
1. Create a user and password that can log on to the CVS service. The passwd file must be created.
VI/var/cvsroot/passwd
The file content is as follows:
Jiaojj: XXXXX: cvsroot
Chenxu: XXXXX: cvsroot
This file indicates that weiqiong and chenxu users can log on to the CVS server. After logon, their permissions are granted to the user cvsroot.
Note: CVs users and server users can be different.
※In fact, system users such as jiaojj must be created.
2. xxxxxx is the password generated by the following files:
VI/var/cvsroot/passwdgen. pl
File Content:
#! /Usr/bin/perl
Srand (Time ());
My $ randletter = "(INT (RAND (26) + (INT (RAND (1) +. 5) % 2? 65: 97 ))";
My $ salt = sprintf ("% C", Eval $ randletter, Eval $ randletter );
My $ plaintext = shift;
My $ crypttext = crypt ($ plaintext, $ salt );
Print "$ {crypttext} \ n ";
3. Modify passwdgen. pl To be executable.
# Chmod 111 passwdgen. pl
If you need a password of some, enter:
Passwdgen. pl "some"
Press enter to obtain the encrypted password and replace xxxxxx in the passwd file
4. Edit the writers file and add the following lines:
Jiaojj
Chenxu
5. Use
CVS-D: pserver: username @ localhost:/var/cvsroot Login
After you press the Enter command and press enter, you are prompted to enter the password of the user name. You enter the password according to your own settings. If there is no error message, it will be successful.
=============== CVS introduction ===================================
CVS is a front-end tool of RCS. It is a version control tool used for multi-user parallel development, and its biggest feature
The "copy-Modify-merge" mechanism is used instead of "lock-Modify-unlock ". Use
CVS generates a repository for storing files. Each directory stored in the repository is called a module.
(Module). When the module is modified, it is detected in the working directory.
To the corresponding directory. All the modifications are completed in the working directory. After the modifications are completed, they are submitted to the warehouse.
Create a new version number and save it.
1. CVs Initialization
(1) Create the cvsroot root directory
Edit the related environment variables and add the definition of cvsroot (for example, add it to the/etc/bashrc file)
):
Cvsroot =/var/cvsroot
Export cvsroot
Create cvsroot at the corresponding location
$ CD/var
$ Mkdir cvsroot
$ CVS-D/var/cvsroot init
The/var/cvsroot directory is generated.
. At the same time,/var/cvsroot/also serves as a file warehouse to store all files.
(2) create a development project
If you start a new project from scratch, you need to create a separate directory and
As a valid organization. If the source file directory is available before you start using it, you only need to enter
This directory is enough.
$ CD/work/Tang
$ Ls cvstest
... C/
$ CD cvstest
Then, you can enter the source file directory:
$ CVS import-m "create source dir" cvstest/C Tang cvstest
The $ cvsroot/cvstest/C directory is generated. Where-M is used to specify the comment information, if
If you do not specify the comment information in the command line, the default editor (vi) is started to require that the comment information be entered. Tan
G and cvstest respectively identify the vendor and release ID.
Note that the import command will introduce all the files and directories (including subdirectories) in the current directory
In the File Repository, specify the module (directory.
2. Command Introduction
-------------
(1) Check the source file
CVS checkout [-r rev] [-d date] [-D dir] [-J merg1] [-J merg2] modules
-R: Check the module of the specified version.
-D check out the module of the specified date
-D: Check the specified directory instead of the module.
-J: merge the current version with the specified version.
Use the following command to check the generated module and generate the module in the current directory completely
The same directory structure:
$ CVS checkout cvstest/C
For modules with complex directory structures, you can specify them in $ cvsroot/modules:
1) $ CVS checkout cvsroot/modules
2) Add the following line to the modules file:
Source cvstest/C
3) then execute:
$ CVS commit-M "add source"
You can use the following command to generate the cvstest/C directory in the current path.
$ CVS checkout Source
The directory generated in the current path is called the working directory. All modifications to the source file should be in
This directory is complete, and files under the $ cvsroot directory in the file warehouse cannot be modified.
(2) Delete, add, and rename files and directories
CVS add [-K kflags] [-m message] files...
-K specifies the default check-out directory for the file later
-M description of the file
The above command will add a new file to the file warehouse, but it will not be true until the command is submitted
Update the File Repository.
CVS remove [Options] files
The above command will delete the file from the file warehouse, but it will only take effect after submission.
Example 1: Add a file
$ CVS checkout Source
$ CD cvstest/C
$ Touch test. c
$ CVS add test. c
$ CVS commit-M "add test. c"
Example 2: delete an object
$ CVS checkout Source
$ CD cvstest/C
$ RM test. c
$ CVS Remove test. c
Use the-F option to combine the preceding two steps.
$ CVS remove-F test. c
If you want to restore the deleted file before submission, you can:
$ CVS add test. c
If you only perform the first step to delete (RM), you can use the following method to restore it:
$ CVS update test. c
You can delete the renamed file before adding it.
For directory modification (rename), you may need to modify the CVS management file. Generally, follow these steps:
Steps:
1) confirm that all relevant modifications have been submitted;
2) enter the directory of the module to be modified in the File Repository and modify (rename or delete) the directory)
$ CD $ cvsroot/modules
$ MV old_dir new_dir
3) If necessary, modify the management file, such as the modules file.
If you want to delete a directory, you should first Delete each file in the directory (including using CVS Remo
Ve) after processing, execute the above step 2nd.
(3) Submit the source file
CVS commit [-RL] [-M mesg] files
-Submit the sub-directories connected to r together
-L submit only local directories (do not submit sub-Directories)
-M comments
After the source file is checked out, all modifications made to the source file in the working directory must be submitted.
It can work on the source files in the file warehouse, and the new files can be assigned a new version number.
(4) release the working directory
CVS release-D Source
This command will delete the working directory cvstest/C (it is recommended to execute this step after submitting the modified module), it is better than using Rm-RF cvstest.
3. Multi-User Development
---------------
In the case of multiple users, if different users modify different parts of the same file, use the following
To merge the checked files with the latest version ):
$ CVS update
(1) Conflict Resolution
When multiple users modify the same file, if the same part is modified
If the content is different, conflicts are inevitable. If there is
File test. C. Its version is 1.4. User a first checks out the file and modifies it.
B checks out the file and submits it to 1.5 in advance. A conflict occurs when user a submits the file again.
(If the file content is different), CVs will prompt you to solve it manually.
Version 1.4 in the File Repository:
# Include
Main ()
{
Int I;
For (I = 0; I
Main ()
{
Int I;
For (I = 0; I
Main ()
{
Int I;
For (I = 0; I
Main ()
{
Int I;
>>>>>>> 1.5
Printf ("count: % d \ n", I );
>>>>>>> 1.5
}
(2) file version management
CVS log [-LR] [-r rev] [-d date] [-W Login] [files…]
-L do not process subdirectories
-R handles subdirectories in the same way.
-R: Specifies the version number.
-D specifies the time
-W: specified Login Name
You can use the preceding command to view all historical versions of the current module or specified file.
CVS annotate [-LR] [-r rev |-d date] files
-L do not process subdirectories
-R handles subdirectories in the same way.
-R: Specifies the version number.
Use the above command to see all the modifications to the specified file (after detection.
Example: $ CVS annotate cvstest/C/test. c
Output:
Version modifier modification time source code
1.1 (Tang 18-Jan-00): # include
1.1 (Tang 18-Jan-00): # include
1.1 (Tang 18-Jan-00 ):
1.1 (Tang 18-Jan-00): Main ()
1.1 (Tang 18-Jan-00 ):{
1.1 (Tang 18-Jan-00): int I = 0;
1.1 (Tang 18-Jan-00 ):
1.1 (Tang 18-Jan-00): for (I = 0; I tags:
CVS
TIPS:
It is best to disable SELinux first and put home, cvsroot, and cvsroot in the graphic interface.
To the owner: cvsroot.
, Group: CVs, and the second row of the/home/cvsroot/config file systemauth = No.