Install and configure CVS in Linux

Source: Internet
Author: User
Install and configure CVS in Linux

1. Install the CVS server:

1. Check whether CVS is installed on your operating system:
#>; Rpm-Qa | grep CVS

If you have not installed the package, you can find it on the RedHat 2nd discs and download the latest RPM package from the Internet. It is easy to find out, but there is actually no Linux version.

2. Create a client user group:

#>; Groupadd Client

3. Create the Cadmin user and directory of the client group:

#>; Useradd-G client-D/cvsroot/Cadmin

4. Add a password for the Cadmin User:

#>; Passwd Cadmin

Then, create a system user
Useradd yqj;
Useradd CZ
Useradd wjq;
Useradd yhc;
All four users belong to their own user groups, because no group is specified here.
Next, set the password for each user.
Passwd yqj;
Passwd CZ;
Passwd wjq;
Passwd yhc;
A user can belong to multiple groups. To control the permission Design for project files, you need to modify the permissions here,
If you only want yqj and CZ to read and write a SRC project (which will be mentioned later), others will not be able to access it, add the two users to passwd and writers.
If a SRC project (which will be mentioned later) only wants yqj to read and write data, and CZ can read but cannot write data, add the yqj user to passwd and writers, add the user CZ to passwd and readers. However, all folders created by system users belong to the group they created. For example, if the A1 folder is created by yqj, the folder also belongs to the yqj group for management, others that do not belong to the yqj group cannot be accessed. Here, you need to add other users to this group.
Usermod-G yqj CZ
-G is the added external group. A user can belong to multiple groups, such as usermod-G yqj, yhc, and wjq CZ.
CZ indicates which user needs to be added to the external group
Usermod-G yqj, yhc, wjq CZ means to add this user to the yqj, yhc, and wjq3 user groups, in this way, the CZ user can access anything written by the three groups of users.
So we can add external groups for the above four users.
Usermod-g cz, wjq, yhc, client yqj
Usermod-G yqj, wjq, yhc, client CZ
Usermod-g cz, yqj, yhc, client wjq
Usermod-g cz, wjq, yqj, client yhc
The biggest advantage of adding external groups is that other users can access the things in the folders created by another user. The specific read/write control should be controlled through readers and writers in CVS.
5. Change the Directory attribute of/cvsroot:

#>; Chmod-r 770/cvsroot

6. Change the user login identity:

#>; Su Cadmin

7. Start to create a single project:

#>; CD/cvsroot/client

If there is no client, create one by yourself. Because I am working on the server and client, I have created two folders under/cvsroot: client and server.

8. start to build a warehouse:
#>; CVS-D/cvsroot/client/src init
#>; CVS-D/cvsroot/client/bin init
The format is the same as above. I have created CVS-D/cvsroot/client/src init.
CVS-D/cvsroot/client/bin init
I treat a folder used by a person as a project. It is convenient to control permissions in the future.
9. Create the CVS Service Startup File. We use the xinetd method:

#>; [Crtl] + [d] switch to the root user identity
#>; CD/etc/xinetd. d
#>; VI cvspserver
If this file is not available, create one by yourself.
Service cvspserver
{
Disable = No
Flags = Reuse
Socket_type = stream
Wait = No
User = root
Server =/usr/bin/CVS
Server_args =-f -- allow-root =/cvsroot/client/src -- allow-root =/cvsroot/client/bin pserver
Log_on_failure + = userid
}

Note: Due to the length limit of xinetd server_args, you can do this when you want to run many single warehouses:

#>; VI cvspserver

Service cvspserver
{
Disable = No
Flags = Reuse
Socket_type = stream
Wait = No
User = root
Server =/cvsroot/CVS. Run
Log_on_failure + = userid
}

Compile the CVS. Run script
If you do not have the CVS. Run file, create one by yourself. The path must be consistent with the above server =/cvsroot/CVS. Run and cannot be created randomly. Here I put cvs. Run under/cvsroot.
#>; VI/cvsroot/CVS. Run

#! /Bin/bash
/Usr/bin/CVS-f -- allow-root =/cvsroot/client/src -- allow-root =/cvsroot/client/bin pserver

#>; Chmod A + x/home/cvsroot/CVS. Run the permission to execute cvs. Run for everyone

10. Join the CVS service:

#>; VI/etc/services

Cvspserver 2401/tcp # pserver CVS Service
Cvspserver 2401/udp # pserver CVS Service

11. Start the CVS service:

#>;/Etc/init. d/xinetd restart
Note: If the corresponding startup command cannot be found here, it must be that xinetd is not installed. Go to your Linux installation disk and find the file to install it. Then you can run this command. I did not install it, I found this file on 3rd disks and installed the file to run it. the RPM file name can be installed.
12. Check whether the cvspserver service has been started:

#>; Netstat-L | grep cvspserver
The following results should be returned:

TCP 0 0 *: cvspserver *: * listen

Ii. User Management of the CVS service:

We have already created two CVS repositories, Src and bin. Next we will create CVS users for the two repositories respectively.

13. Create a user name and password that can log on to the CVS server:

#>; Su Cadmin
#>; VI/cvsroot/client/src/cvsroot/passwd
Create one without passwd. The following is the user and password format.
Yqj: ******: yqj
CZ: *****: CZ
Wjq: ******: wjq
Yhc: ******: yhc
The password here must not be a clear code. It is calculated using the password calculator. below, there is a computer password. You should replace it with ** and replace it later.
#>; VI/cvsroot/client/bin/cvsroot/passwd

Yqj: ******: yqj
CZ: *****: CZ
Wjq: ******: wjq
Yhc: ******: yhc
(Note: *** it must be an encrypted password. It is not an encrypted password and is not recognized by the system. Therefore, you must encrypt the following encrypted file)
These two files mean that yqj, CZ, wjq, and yhc belong to different groups of users. Then, grant permissions to these four users and create two files, readers and writers, under/cvsroot/client/bin/cvsroot/. These two files are used to control permissions, for example, if you want your src project to allow only yqj and CZ to read and write, add the yqj and CZ names to writers. The format is as follows:

# Vi/cvsroot/client/src/cvsroot/writers
Yqj
CZ
Only these two users can read and write the SRC project directory.

If wjq is allowed to read SRC, add wjq to readers. The format is the same as above ,:
# Vi/cvsroot/client/src/cvsroot/readers
Wjq

Note: The CVS user here is a shadow to the corresponding user of the system. The four users created above are all system users.

14. ***** is the password generated by the following files:
This file is used to generate a password.
#>; VI/cvsroot/passwd. pl

#! /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}
////";

#>; Chmod A + x/cvsroot/passwd. pl

15. If you want to generate a password of "123456", then:

#>;/Cvsroot/passwd. pl // "123456 ////"

Press enter to obtain the encryption password, and use it to replace ***** in the passwd file *****

16. OK. CVS has been fully installed. If you want a user to have the SRC permission, you can give it to/cvsroot/client/src/cvsroot/passwd.
If you want a user to have both SRC and bin permissions
/Cvsroot/client/src/cvsroot/passwd and
Add a user with the same user name and password to/cvsroot/client/bin/cvsroot/passwd. Finally, let's try it out:

#>; CVS-D: pserver: yqj@172.30.5.107:/cvsroot/client/src Login
(Note:/cvsroot/client/src is the path of the database you have created. It must be the same as the path under server_args in the cvspserver file. Otherwise, an error will occur)
After you press the Enter command and press enter, the system prompts you to enter the yqj password. If no error message is displayed, the password is entered successfully (my machine IP address is 172.30.5.107)

This is used for testing in Linux. For testing in windows, I have a tool named wincvs. You can also try it out, which is quite useful.

How to Use wincvs
First install the software, then open the software, choose manage> set,
 
Click Settings and set them. The specific settings are as follows,
 
Select pserver for authentication, and enter/cvsroot/client/project name in the path. Here, my project is SRC, so I wrote SRC.
The following is the address of the CVS server. The user name is the user name In passwd under the project you connect to. Otherwise, you cannot log on. Here, my project is SRC, the CZ user already has this user in my/cvsroot/client/src/cvsroot/passwd file, so I log on with this user and click OK.

Then start logging on. For example

Choose manage> log on

 

After confirmation, as shown in figure

 
Click OK to see the following information.
 
Enter the password to view the following information,
 
The following prompt indicates that the logon is successful. Now you can add a file management file to the SRC project. The CVS command is required for the specific management setting command, if you are not familiar with the CVS command, you can learn a wincvs operation manual, because the CVS command and wincvs can achieve the same effect. If you are not familiar with the Linux system, you 'd better use wincvs, this is easy to get started. Users familiar with Linux can easily learn about the CVS command. After configuring CVs and logging on to it, you can easily learn about it.

Then I will write a management control document on wincvs to help you manage your project files.
 

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.