1. Download source code
Find the source code package of CVS through the search engine, or search for it from the official CVS website cvshome.org. Due to the history of CVs, some security vulnerabilities have also occurred, therefore, it is recommended to regularly go to its official website to see if the latest version is available.
2. Compile and install
[Root @ Terry SRC] # tar-xjpvf CVS-1.12.5.tar.bz2
[Root @ Terry SRC] # cd CVS-1.12.5
[Root @ Terry CVS-1.12.5] #./configure -- prefix =/usr/local/terry_yu/CVS
-- Disable-server-flow-control
[Root @ Terry CVS-1.12.5] # Make
[Root @ Terry CVS-1.12.5] # make install
Run the preceding command to install CVS in the/usr/local/terry_yu/CVS directory.
Note: In addition to using the source code package for installation, you can also use the RPM package for installation.
3. Set to start the CVS Service
In Linux, the CVS service can be started through inetd, Xinetd, or tcpwrapper. inetd has been replaced by xinetd for many security reasons. Here we use xinetd to start the CVS service.
In/etc/xinetd. create a configuration file for the CVS service under the d directory, for example:/etc/xinetd. d/cvspserver, edit/etc/xinetd. d/cvspserver, enter the following content:
Service cvspserver
{
Disable = No
Socket_type = stream
Wait = No
User = root
ENV = home =/home/cvsroot pserver
Server =/usr/bin/CVS
Server_args =-f -- allow-root =/home/cvsroot pserver
}
Note:
1) pserver indicates password-based access. This is the most common access method. Other methods include gserver, kserver, and Ext. For higher security, you can use SSH to encrypt passwords and data streams, however, pserver is selected for user convenience.
2) -- allow-root is the directory of the specified repository. Multiple repository can be created.
3) The strings after env cannot have spaces that should be consecutive.
Then restart xinetd:
[Root @ Terry bin] #/etc/rc. d/init. d/xinetd restart
Stopping xinetd: [OK]
Starting xinetd: [OK]
After the xinetd service is restarted, the CVS service also starts to work.
4. Create a repository on the CVS server
Create a group named CVs and a user named cvsroot. users who want to access the CVS service will join the group:
[Root @ Terry root] # groupadd CVS
[Root @ Terry root] # useradd-g cvs-S/sbin/nologin cvsroot
[Root @ Terry root] # chown-r cvsroot/home/cvsroot
Next, initialize:
[Root @ Terry root] # CVS-D/home/cvsroot init
In this way, the cvsroot directory is generated in the/home/cvsroot Directory, which stores some configuration files, such as config, and then sets permissions:
[Root @ Terry root] # chown-r cvsroot. CVS/home/cvsroot
[Root @ Terry root] # chmod-r ug + rwx/home/cvsroot
[Root @ Terry root] # chmod 644/home/cvsroot/config
To ensure the security of the CVS system, modify the/home/cvsroot/config file and remove the comment # Before "# systemauth = No, change "systemauth = No" to "systemauth = No", and create accounts for developers one by one. Do not assign user directories to new accounts because they will be used as a virtual user account. The specific commands are as follows:
[Root @ Terry root] # useradd-g cvs-M bogus
[Root @ Terry root] # passwd bogus
The above command creates a user bogus without the Home Directory, then copies the system shadow file to cvsroot, and rename it passwd:
[Root @ Terry root] # cp/etc/shadow/home/cvsroot/passwd
[Root @ Terry root] # chmod 0644/home/cvsroot/passwd
Then, modify the passwd file, delete all rows except bogus, remove all contents after the second colon in each row, and add the string cvsroot to the file, in the following format:
Bogus: nd5 $ j8n9bw5dkv. npdxfdsh: cvsroot
Then, delete the user bogus you just added in the system:
[Root @ Terry root] # userdel-F bogus
Now, the CVS server has been installed and configured, so that your CVs users can only log on to your CVS server using the users specified in passwd. Note that: the method described in this article applies to a small number of users. If you have a large number of developers, we recommend that you connect to LDAP or database for user authentication.