CVS 服务器

CVS 是一个版本控制系统。您可以使用它来记录源文件的历史。

安装

在终端提示符后输入下列命令来安装 cvs

sudo apt-get install cvs

在您安装 cvs之后,您将安装 xinetd 来启动和停用 cvs 服务器。在提示符后输入下列命令以安装 xinetd

sudo apt-get install xinetd

配置

Once you install cvs, the repository will be automatically initialized. By default, the repository resides under the /var/lib/cvs directory. You can change this path by running following command:

cvs -d /your/new/cvs/repo init

Once the initial repository is set up, you can configure xinetd to start the CVS server. You can copy the following lines to the /etc/xinetd.d/cvspserver file.

service cvspserver
{
     port = 2401
     socket_type = stream
     protocol = tcp
     user = root
     wait = no
     type = UNLISTED
     server = /usr/bin/cvs
     server_args = -f --allow-root /var/lib/cvs pserver
     disable = no
}

[注意]

如果你改变缺省的库目录 (/var/lib/cvs) 那么您必须要编辑库。

Once you have configured xinetd you can start the cvs server by running following command:

sudo /etc/init.d/xinetd start

您可以执行以下命令来确定 CVS 服务器正在运行:

sudo netstat -tap | grep cvs

当您运行该命令时,您可以看到类似下面的行:



tcp 0 0 *:cvspserver *:* LISTEN 
 

在这里您可以继续添加用户,添加新的项目以及管理 CVS 服务器

[警告]

CVS 允许用户添加独立于 OS 安装的用户。也许最容易的方式就是让 CVS 使用 Linux 的用户,虽然它有潜在的安全隐患。详细请参考 CVS 手册。

添加项目

This section explains how to add new project to the CVS repository. Create the directory and add necessary document and source files to the directory. Now, run the following command to add this project to CVS repository:

cd your/project
cvs -d :pserver:username@hostname.com:/var/lib/cvs import -m "Importing my project to CVS repository" . new_project start

[提示]

You can use the CVSROOT environment variable to store the CVS root directory. Once you export the CVSROOT environment variable, you can avoid using -d option in the above cvs command.

The string new_project is a vendor tag, and start is a release tag. They serve no purpose in this context, but since CVS requires them, they must be present.

[警告]

当您新添项目时,您所用的 CVS 用户必须对 CVS 库 (/var/lib/cvs) 有写权限。缺省状态下,src 组有对 CVS 库的写权限,因此,您可以添加用户到该组,然后就该用户就可以在 CVS 库中添加和管理项目了。