Configure and use CVS in Linux

Source: Internet
Author: User

 

 

Part 1 configuration of the CVS server

1. CVs Overview:

CVS is the abbreviation of Concurrent Versions System. It is a popular and excellent version management and control tool. It is favored by most developers and system management, it is also used to manage other daily documents (such as Word workersCompositionFiles. This section briefly introduces the installation, configuration, and usage of the CVS server to help you use cvs for version management and control as soon as possible.

 

2. Install the CVS server

By default, CVS has been installed in RedHat Linux, which can be run with the Linux Command Line:

Rpm-Q CVS

If the version information of CVS appears, it indicates that the installation is successful.

The CVS server installation package can be downloaded from many places on the Internet or from the official website of CVS. Download the corresponding version based on your system and install it. Because our project is to use the CVS server for Version Management in RedHat Linux, this article will mainly introduce it based on Redhat Linux. First, download the RPM package of the CVS server. Of course, you can also download packages of other methods, such as the sourceProgramPackage, and then use the following command to install:

Rpm-IVH cvs-1.11.1p1-7.rpm

 

3. Configure the CVS server

The first thing after installation is to configure the configuration file of the CVS server so that it can work properly. First, add the cvspserver to the/etc/services file to make it the entry to a Linux service, that is, the CVS server routine. The configuration is as follows:

Cvspserver 2401/tcp # CVS client/server operations

Cvspserver 2401/udp # CVS client/server operations

If the above two lines of text already exist in the file, you do not need to add them.

 

4. Configure xinetd and use xinetd to start the CVS verification Server:

Enter/etc/xinetd. d/directory, and then edit a text file. The name must be the same as that in/etc/services. Therefore, cvspserver is used as the file name. The file content is as follows:

Service cvspserver

{

Disable = No

Flags = Reuse

Socket_type = stream

Wait = No

User = root

Server =/usr/bin/CVS

Server_args =-f -- allow-root =/usr/cvsroot pserver

Log_on_failure + = userid

}

Edit the file and test whether the cvspserver service is configured successfully.

Run

/Etc/init. d/xinetd restart

Restart the service. After the service is successfully started, run the following statement to verify whether the service is properly started:

Telnet local host 2401

If the following words appear:

Trying 127.0.0.1...

Connected to localhost.

Escape Character is '^]'.

Input hi and the following words will be output.

CVS [pserver aborted]: Bad auth protocol start: Hi

 

Connection closed by foreign host.

If the preceding problem occurs, the CVS user verifies that the server has been configured successfully.

If the following words are displayed, the configuration is unsuccessful. Check the preceding configuration again:

Trying 127.0.0.1...

TELNET: connect to address 127.0.0.1: Connection refused

 

5. Configure the CVS User:

First, create a user group CVs, which can be named by groupadd or addgroup, or you can directly edit the/etc/group file to add this group, and then add a user cvsuser:

Groupadd CVS

 

Useradd cvsuser-G CVS

 

Passwd cvsuser

 

Set a new password.

 

Create the cvsroot directory under the/usr directory (you can also create the directory in another directory, but it should be consistent with the option in the cvspserver file), and then modify the owner and attributes of/usr/cvsroot:

 

CD/usr

Mkdir cvsroot

Chown-r cvsuser: CVs cvsroot

Chmod-r 771 cvsroot

 

6. initialize the CVS server

Another important thing after installing the CVS server is to initialize the root directory of the CVS server. The CVS projects created in the future will be created under this directory. The command used is as follows:

CVS-D/usr/cvsroot init

If no prompt is displayed, the initialization is successful. After the initialization is successful, the cvsroot directory is created in the/usr/cvsroot Directory, which contains the following files:

-R -- 1 Root 493 Apr 520: 19Checkoutlist

-R -- 1 Root 693 Apr 520: 19Checkoutlist, V

-R -- 1 Root 760 Apr 520: 19Commitinfo

-R -- 1 Root 960 Apr 520: 19Commitinfo, V

-R -- 1 Root 527 Apr 520: 19Config

-R -- 1 Root 727 Apr 520: 19Config, V

-R -- 1 Root 753 Apr 520: 19Cvswrappers

-R -- 1 Root 953 Apr 520:19Cvswrappers, V

-R -- 1 Root 1025 Apr 520: 19Editinfo

-R -- 1 Root 1225 Apr 520: 19Editinfo, V

Drwxrwxr-x 2 root Root 4096 Apr 520: 19Emptydir

-RW-1 Root 0 Apr 520: 19History

-R -- 1 Root 1141 Apr 520: 19Loginfo

-R -- 1 Root 1341 Apr 520: 19Loginfo, V

-R -- 1 Root 1151 Apr 520:19Modules

-R -- 1 Root 1351 Apr 520:19Modules, V

-R -- 1 Root 564 Apr 520: 19Notify

-R -- 1 Root 764 Apr 520: 19Notify, V

-R -- 1 Root 649 Apr 520: 19Rcsinfo

-R -- 1 Root 849 Apr 520: 19Rcsinfo, V

-R -- 1 Root 879 Apr 520: 19Taginfo

-R -- 1 Root 1079 Apr 520: 19Taginfo, V

-RW-1 Root 0 Apr 520: 19Val-tags

-R -- 1 Root 1026 Apr 520: 19Verifymsg

-R -- 1 Root 1226 Apr 520: 19Verifymsg, V

 

In this way, the directory/usr/cvsroot becomes the root directory of the CVS server, and the directories created later will be stored in this directory by default.

7. log on to the CVS server (in Linux or other UNIX systems ):

Run the following command:

CVS-D: pserver: cvsuser @ localhost:/usr/cvsroot Login

Prompt to enter the password and enter the password set above. If no prompt is displayed, the logon is successful.

After successful logon, The. cvspass file is generated in the $ home directory of the current user. You can use VI to view the file.

Because files starting with "." are hidden in Linux, you can use the following command to view them:

Ls-

This file records user logon information. Run the logout command to delete the logon information in the file.

CVS-D: pserver: cvsuser @ localhost:/usr/cvsroot logout

 

The following describes the syntax of the logon command:

Here, pserver indicates that user logon authentication is performed using the pserver method. Generally, CVS servers adopt this method. Of course, other methods can be used. For details, refer to the relevant materials;

: Cvsuser indicates the user name to log on to, as long as it is a member of the CVS group, for example, cvsuser;

@ Host indicates the server to be logged on. It can be a DNS name or an IP address, for example, 192.168.0.1;

:/Usr/cvsroot indicates the directory of CVS on the server, or other directories (determined by the Directory you specified in 6th for init initialization );

Tip:

A. You can also write the export cvsroot =: pserver: cvsuser@192.168.0.1:/usr/cvsroot statement directly in the user's initialization file (such :. bash_profile:

CVS Login

Enter a password to log on to the CVS server.
B. If you log on locally, you can directly write the export cvsroot =/usr/cvsroot statement in your initialization file, for example,/etc/profile; run the following command to make the environment variable take effect:

Source/etc/profile

 

8. Add a new project module to CVS

Generally, we already have one or more projects, so that we can use the following steps to generate a new CVS project. Place a project file in CVS for version control, which is called import in CVS terminology ). We can see from the name that some preparations need to be made before the import.

The basic requirement for input operations is to have a "clean" directory structure. "Clean" means that all files that do not require version control are removed (such as compiled files and backup files ). This is important if the project has started for a while. Some files in the directory may not be placed under version control, but you want to put them here. In this case, you need to remove them before entering them, and then move it back.

Note that CVS deems that the empty directory does not exist. To add a directory that does not contain files but does not contain subdirectories, you need to create a dummy file under it. We recommend that you create a file named readme.txt with a brief description of the directory.

Enter the directory of an existing project, such as cvstest:

CD/home/cvsuser/cvstest

Run the following command to import the project file to the CVS Repository:

CVS import-M "This Is A cvstest project" cvstest tengtu start

 

Description: import is one of the CVS commands, indicating to input the project file to the CVS warehouse.

-The string following the M parameter is the description text to describe the project. If the-M parameter is not added, CVs will automatically run an Editor (usually VI, however, you can change the environment variable editor to the editor you like to use .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.