Redhat7.0下CVS server 及webcvs配置

由 solaris 在 01-09-2003 13:30 发表:

Redhat7.0下CVS server 及webcvs配置

从网上挖掘出来的好文章,希望对大家有帮助。

系统为Redhat 7.0,运行Apache

1.CVS Server配置

RHLinux# mount /mnt/cdrom (如果不好用的话,你可以试一下mount -t iso9669 /dev/cdrom /mnt/cdrom)

RHLinux# cd /mnt/cdrom/Redhat/RPM (不用解释了吧)

RHLinux# rpm -ivh cvs-1.10.8.8.i386.rpm (安装cvs,你可以用rpm -qpl ...看安装的详细信息)

RHLinux# vi /etc/service

(应该有

cvspserver 2401/tcp # cvs client/server operations

cvspserver 2401/udp # cvs client/server operations

这两行)

(要使cvs正常运行还需要对需要使用cvs的用户进行设置,下面是我在

配置cvs使用的方法。首先建立一个用户组cvs,可以使用groupadd或者

addgroup命名,也可以直接编辑/etc/group文件添加这个组,然后添加

一个用户cvsroot, 然后修改/etc/passwd文件使cvsroot用户的缺省组

是cvs组,而不是cvsroot组。建立/cvsroot目录,然后修改/cvsroot的

属主及属性)

RHLinux# groupadd cvs

RHLinux# adduser cvsroot

RHLinux# passwd cvsroot

修改/cvsroot的属主及属性

RHLinux# chown cvsroot.cvs /cvsroot

RHLinux# chmod 755 /cvsroot(原本应该是771,但是我们要配置cvsweb.cgi,下面再谈)。

RHLinux# cd /etc/xinetd.d

RHLinux# vi cvspserver(创建一个新文件,文件名随意,注释为文件内容)

/************************************************

service cvspserver

(service后面的名称一定要和你在/etc/service文件中的cvs服务名称

一样,但是我不知道/etc/service文件中的cvs服务名称可以改否,rpm

方式安装完后,那两行就在那了

{

disable = no

flags = REUSE

socket_type = stream

wait = no

user = root

server = /usr/bin/cvs

server_args = --allow-root=/home/cvsroot pserver

log_on_failure += USERID

}

************************************************/

RHLinux# cvs -d /home/cvsroot init

(对cvs进行初始化,你会发现/home/cvsroot下多了一个CVSROOT的子目录)

RHLinux# /etc/init.d/xinetd restart (重新启动xinetd)

cvs -d server:cvsroot@host:/home/cvsroot login

(输入cvsroot用户在服务器上的口令,没有出现错误提示就表示成功了.)

(如果cvspserver成功起动后,netstat -l | grep tcp应能看到以下行:

tcp 0 0 *:cvspserver : LISTEN)

2.WinCvs(Windows下客户端的配置):

启动wincvs在Admin菜单中选择preferences然后在global页中设置CVSROOT,就是 server:cvsroot@host:/cvsroot。在认证方式中选择passwd file on the cvs server,在下面的版本号中选择合适的版本,执行Admin菜单中的login,在提示框输入口令,如果Output窗口出现以下提示:

CVS exited normally with code 0

就表示我们现在可以在Windows下使用cvs服务了。]

如何使用wincvs把自己的项目加到cvs中去

  1. Make sure that all the source files you want to check into CVS are on one directory (or

subdirectories). This directory (folder) should NOT contain anything else! That is, it should not

contain executables, object files (.o), class files (.class), etc. It should only contain the

source files.

  1. 确认你想加入的源文件全部在一个目录下。这个目录仅仅应当包含源文件,不应该有其他任何的可执行体、

.O,.class....等类型的文件

  1. 在wincvs "Modules"窗口中包含你的源文件的目录被选中

  2. 在菜单"Create" ->"Import Module"选择目录,把它导入CVS

  3. 重命名你的目录

  4. 其他相关的内容请看wincvs文档

cvsweb配置

cvsweb是一个perl程序,现在的版本是1.93,记得要用新版,1.8以下有一个小小的漏洞.

由于是cgi程序,是以nobody用户执行的,所以/cvsroot的属性要设成775。开始我按章照搬,把属性改成

771,结果项目的目录就是不出来,埋葬了半天的青春:(还有记得把/cvsroot/CVSROOT/history的属性

改成666。cvsweb.conf里%CVSROOT数组的Configuration设成/cvsroot,就是cvs仓库的路径不要那个长长

CVSROOT变量。这些其实在它的说明文档和程序注释里都讲到了,只是这个世界是懒人的世界:)

一切都阳春白雪,可以埋头写程序了?只是cvs还有一个小小的DoS漏洞要跟大家说一下:(

每个cvs的操作过程会以操作用户的身份在/tmp下临时建一个锁定了的目录cvs_servPID,这时如果有人建

了大量的同类文件就会使cvs的操作出错,会提示:

cannot change permissions on temporary directory

Operation not permitted

下面是测试的perl程序:

#!/usr/bin/perl

#$min和$max的值根据实际情况修改

$min=400;

$max=4000;

for ($x=$min;$x<=$max;$x++) {

open CVSTMP, ">>/tmp/cvs-serv$x" or die "/tmp/cvs-serv$x: $!";

chmod 0600, "/tmp/cvs-serv$x";

close CVSTMP;

}

解决方法:

使用server.c中的mktemp(3)函

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus