Parallel Version System CVS simple tutorial

Source: Internet
Author: User
Article Title: A simple tutorial on parallel version system CVS. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

CVS is the abbreviation of Concurrent Version System (parallel Version System) for Version management. If you have participated in projects that have been jointly developed by many people, you must have experienced the following pain points: Because multiple people modify the same file at the same time, the programs that have worked hard to modify have been completely deleted by others. In addition, if your software/program has released three versions, and you need to modify the second version, you may be crying because you only keep the latest version. In addition, you have made some changes to the program, but there are few changes. You just want to send a different file between two versions to colleagues in the distance, so that the mailbox is not big enough, network speed is too slow. To solve such problems, such as generating patch files and modifying historical versions, a group of hackers (comments) built on the mature SCCS and RCS in the original Unix system, CVS is developed. (SCCS: Source Code Control System, RCS: Revision Control System)

The basic working principle of CVS is as follows: Create a warehouse on a server and Store source programs of many different projects. The repository administrator manages these source programs in a unified manner. In this way, only one person is modifying the file. Conflicts are avoided. Before using the repository, each user must first download the project files in the repository to the local device. Any modifications made by the user are first made locally and then submitted using the cvs command, which is uniformly modified by the cvs Repository administrator. In this way, file changes and conflict control can be tracked.

Because CVS is a typical C/S-structured software, it is also divided into two parts: server and client. However, most CVS software combines them into one.


In combination with documents and some online resources, I want to write a very simple "quick success" teaching material.

The following are my steps and practices:

Prerequisites:

  • Root permission;
  • For CVS software, find the related rpm, tgz, deb, and other packages, or
    Http://www.cvshome.org/CVS/Dev/code
    Download the original program compilation and installation. Here I am not going to introduce its installation. Please refer to the CVS documentation for installation. I use the Slackware tgz package. The installation command is
    # Installpkg cvs *. tgz
    For other packages, see the command of the corresponding package management tool.
  • A certain amount of system resources requires a certain amount of memory (32 MB can work well), a certain amount of disk space, depending on the size and quantity of your project.
Set up a CVS server:
  1. Create the CVSROOT directoryBecause the user's permission to read and write files in CVSROOT is involved, the simple method isCreate a group, and then create an account that belongs to the groupIn the future, all users with read and write permissions will belong to this group. Assume that we create a group named cvs and the user name is cvsroot. The command for creating the group and the user is as follows:

     

      # Groupadd cvs
      # Adduser cvsroot

       

    The generated user home directory is in/home/cvsroot (based on your system)

     

  2. Log On with the cvsroot user,Modify/home/cvsroot (CVSROOT) PermissionsGrant the same group the read and write permissions:

     

      $ Chmod 771. (Or 770 should be fine)

      Note: This part of work is done according to the instructions in the Document. Do you need to do this without a test? I will make a careful description of the tutorial in a later version after the test. if you have any experience in this area, please provide it to me. Thank you.
       

  3. Create a CVS Repository (still the cvsroot user) and run the following command:

     

      $ Cvs-d/home/cvsroot init

       

  4. Log in as root and modify/etc/inetd. conf (the system that uses xinetd does not have this file) and/etc/services,

      If the inetd system is used, add the following in/etc/inetd. conf:
      Cvsserver stream tcp nowait root/usr/bin/cvs-f -- allow-root =/home/cvsroot pserver

      Note: The above line is a single whole line./usr/bin/cvs should be the command path of your cvs version. Please adjust it according to your system. /home/cvsroot is the path of your CVSROOT. Please make adjustments based on the contents of the Created directory above.

      If yesTo use the xinetd system, you must create the file cvspserver in the/etc/xinetd. d/directory (this name can be defined by yourself), The content is as follows:


      # Default: on
      # Description: The cvs server sessions;

      Service cvsserver
      {
      Socket_type = stream
      Wait = no
      User = root
      Server =/usr/bin/cvs
      Server_args =-f -- allow-root =/cvsroot pserver
      Log_on_failure + = USERID
      Only_from = 192.168.0.0/24
      }


      WhereOnly_from is used to restrict access and can be modified or not based on actual conditions.. Modify the File Permission:


      # Chmod 644 cvspserver

      Add the following to/etc/services:


      Cvsserver 2401/tcp

      Note: cvsserver is an arbitrary name, but it cannot be the same as an existing service. Modify/etc/inetd with the name above. the first entry in the conf line is consistent. here I use the password authentication method of CVS, and other authentication methods of CVS. I have not tried it. If you have experience, please add it. Thank you.
       

  5. Add availableCVS service user to cvs Group:
      Modify/etc/group as the root user and add the user name that needs to use CVS to the cvs group. For example, if you want laser and gumpwu to use the CVS service, the modified/etc/group should have the following line:

      Cvs: x: 105: laser, gumpwu


      On your system, GID may not be 105. It doesn't matter. laser and gumpwu should be separated by commas and written after the last colon. of course, if the distribution version such as RedHat has tools such as linuxconf, it will be easier to use tools to do this.

  6. Restart inetd to make the change take effect:

     

      # Killall-HUP inetd

      If xinetd is used:


      #/Etc/rc. d/init. d/xined restart

In this way, the server settings are complete. We will proceed to the client.

Set the client

For Linux (or other * nix), the client and server software are the same. For Windows, MAC, and other platforms, go

Http://www.loria.fr/cgi-bin/molli/wilma.cgi/rel

Find the corresponding client software. Here I will first talk about how to do it in Linux (* nix:

  1. Set the environment variable CVSROOT:

     

      $ Export CVSROOT =: pserver: laser @ the_server_name:/home/cvsroot

      Note: Here pserver is the access method, and I set password authentication above, so here is pserver. If your CVS server is set to another access mode, you need to modify it accordingly. laser is the user name that can use the CVS server. Here you can modify it according to your settings. In this version, I set the password file of the System user directly, that is to say, laser must be a valid user on the CVS server. Of course, there is a security problem here. CVS can be set as its own user. I will add this content in future versions, you can also provide additional information or read the CVS documentation directly. the_server_name is the name or IP address of the CVS server. Enter/home/cvsroot as the CVSROOT directory of your CVS server based on your CVS server settings or ask the administrator. you can put this line in your shell profile.(. Bash_profile,. Profile, etc.) so you don't have to repeat a long string of commands each time.
       

  2. Log on to the CVS server:

     

      $ Cvs loginAt this time, cvs will ask you the password. Please press your password on the CVS server. Here is the password of the System user of laser on the CVS server:
      Passwd: xxxxxxxx


      After successful login, A. cvspass file will be created in your home directory, and no password will be entered later.

Okay. The client settings are complete.

Managing cvs servers

The server is ready for use. Now everyone is most concerned about how to manage the server. For example, I want some people to have the permission to read and/or write the CVS repository, but what if I don't want to give it system permissions?


It is not difficult. There is a cvsroot directory in the home directory of the cvs Administrator (I am a 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]

If you want a user to be a cvs user rather than a system user, you need to set this file. After installation, this file may not exist. You need to manually create it as a cvs administrator, of course, according to the above format, the second field is the user's encrypted password, which is encrypted with crypt (3). You can write a program for encryption by yourself, you can also use the lazy method introduced by me: first create a system user, whose name is the same as that of the cvs user. The password is the password that is prepared for the cvs user, after the user is created, copy the second field of the user from/etc/shadow and delete the user. this method is more convenient to deal with a small number of users, so it is not suitable for a large number of users, and there are also potential security risks of conflicting conditions (race condition), and root permissions are required. however, the benefits are nothing more. it is not difficult to write a small program. You can search for it in the Forum programming version. A friend has already written a post on it.

The third field is the equivalent system user name. In fact, it is to grant an equivalent system user permission to a cvs user. In the following example, you will understand its functions.

Readers: a user list file with cvs read permission. It is a one-dimensional list. In this file, users only have read permission for cvs.

[1] [2] Next page

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.