CVS环境搭建

来源:互联网 发布:电极 cnc 编程 编辑:程序博客网 时间:2024/05/14 22:28

CVS安装配置文档

1、查看是否安装了CVS

[root@host~]# rpm -aq |grep cvs

cvs-1.11.22-7.el5

如果没有安装,那么自己下载rpm包,或者在光盘中提取,或者yum install,一般安装在/usr/bin/cvs目录下

 

2、建立cvs用户组,便于cvs管理

[root@host ~]# groupaddcvs

 

3、建立cvs组的cvsroot用户和所属的目录

[root@host ~]# useradd -gcvs -G cvs -d /home/cvsroot cvsroot

 

4、为cvsroot用户添加密码

[root@host ~]# passwdcvsroot

 

5、建立存放项目的仓库,并改变目录属性

[root@host ~]# mkdir /cvs_dir

[root@host ~]# chmod 775 /cvs_dir

 

6、初始化cvs源代码库,此操作会生成/cvs_dir/CVSROOT目录,其下为一些初始化文件

[root@host ~]# cvs -d /cvs_dirinit

 

7、创建可以登录的cvs用户和密码,需要创建/cvs_dir/CVSROOT/passwd文件

[root@host CVSROOT]# vimpasswd

test:DHY/.X5uFDmJo:cvsroot

  格式说明

用户名:密码:系统等效用户。例如test用户的权限和cvsroot的权限一样。

用于生成密码的脚本passwd.pl为:

#!/usr/bin/perl

srand (time());

my $randletter ="(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";

my $salt = sprintf("%c%c", eval $randletter, eval $randletter);

my $plaintext = shift;

my $crypttext = crypt($plaintext, $salt);

print"${crypttext}\n";

[root@host ~]# chmod 755passwd.pl

[root@host ~]# ./passwd.pl  cvstest

DHY/.X5uFDmJo

则生成的cvstest的密文为DHY/.X5uFDmJo

 

8、加入cvs服务

[root@xhx ~]# vim/etc/services 加入下面两行,如果有就不用加了

cvspserver 2401/tcp#pserver cvs service
cvspserver 2401/udp #pserver cvs service

9、使用的是xinetd方式,在xinetd.d目录下添加需要启动的服务:

[root@xhx ~]# cd/etc/xinetd.d/

[root@xhx xinetd.d]# cp cvs cvspserver

[root@xhx xinetd.d]# vim cvspserver

service cvspserver

{

        disable                 = yes

        port                    = 2401

        socket_type             = stream

        protocol                = tcp

        wait                    = no

        user                    = root

        passenv                 = PATH

        server                  = /usr/bin/cvs

        env                    = HOME=/var/cvs

        server_args             = -f --allow-root=/cvs_dir pserver

#       bind                    = 127.0.0.1

}

注:如果有多个repository的话,按照下面的方式修改:

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

然后添加对应的用户ncrroot,让该用户的根是/home/ncrroot,即在/home/ncrroot/CVSROOT的passwd中加入该用户的用户名、密码和等效的系统用户。

passwd的最后为新建的用户名ncrroot

 

10、重新启动xinetd服务:

[root@xhx xinetd.d]#/etc/rc.d/init.d/xinetd restart 或者 service xinetd restart

 

11、检查cvs服务是否已经启动:

[root@xhx xinetd.d]#netstat -l |grep cvspserver

tcp       0      0 *:cvspserver                *:*                         LISTEN

 

12、测试:从其他能访问到cvs server的机器登录cvs服务器

[root@xhx xinetd.d]# cvs -d:pserver:test@host:/cvs_dir login

Logging in to :pserver:test@host:2401/cvs_dir

CVS password:

[root@xhx xinetd.d]#

如果不出现错误,则说明登录成功了。


13、在CVSROOT目录下可以创建readers和writers来进行用户的权限管理。

在reeder中的用户只允许读取该module的内容

在writers中的用户可以修改该module的内容

同时存在于两个文件中的用户只允许读取该module的内容

其中需要注意的是该cvs目录必须是cvsperver中已经写好的module,否则CVSROOT下的reader和writer不会起作用。

原创粉丝点击