Chinaunix

标题: CVS服务器的安装和配置 [打印本页]

作者: gavinx    时间: 2007-07-21 14:51
标题: CVS服务器的安装和配置
建立Repository

方法11. mkdir /home/cvsroot
2. cvs -d /home/cvsroot init
方法21. export CVSROOT=/home/cvsroot
2. cvs init
Note: -d将会覆盖CVSROOT环境变量添加用户与组

1. groupadd cvs
2. useradd cvsroot
3. chown -R cvsroot:cvs /home/cvsroot
4. chmod 775 -R /home/cvsroot
5. add other user for cvs server:
   adduser jianfeng
   usermod -G cvs jianfeng 配置/etc/services文件

添加cvspserver(如果有就不要加了)
  cvspserver 2401/tcp # cvs client/server operations
  cvspserver 2401/udp # cvs client/server operations  配置inetd(或xinetd)

1. 对于inetd(Debain)
   编辑/etc/inetd.conf,加入
   cvspserver stream tcp nowait root /usr/bin/cvs --allow-root=/home/cvsroot pserver
   允许多个仓库:
   cvspserver stream tcp nowait root /usr/bin/cvs --allow-root=/home/cvsroot
   --allow-root=/home/jx/cvs pserver
2. 对于xinetd(RedHat)
   编辑/etc/xinetd.d/cvspserver
  service cvspserver
  {
  disable = no
  socket_type = stream
  wait = no
  user = root
  env = HOME=
  server = /usr/bin/cvs
  server_args = -f --allow-root=/home/cvsroot pserver
  }
  允许多个仓库:
   service cvspserver
   {
   disable = no
   flags = REUSE
   socket_type = stream
   wait = no
   user = root
   server = /cvsroot/cvs.run
   log_on_failure += USERID
   }
   (xinetd的server_args长度限制,创建一可执行的cvs.run脚本)
   cvs.run
   #!/bin/bash
   /usr/bin/cvs -f
   --allow-root=/home/cvsroot
   --allow-root=/home/jx/cvs
   pserver
3. 重启xinetd
  /etc/rc.d/init.d/xinetd restart(for redhat)
  /etc/init.d/inetd restart (for debian)
管理CVS服务器

CVS服务器认证

当认证一用户时,CVS服务器首先检查"$CVSROOT/CVSROOT/passwd"文件是否存在此用户,
如果存在用户的entry, 就用该entry验证. 否则,如果SystemAuth=yes, 然后再用操作
系统的passwd(/etc/passwd)文件做认证.
CVSROOT下的passwd文件与/etc/passwd文件格式不同,
{cvs 用户名}:[加密的口令]:[等效系统用户名]
例:test2:yXgbAY2CWc882:cvsroot
CVS服务器读写权限的控制

1. readers:有 cvs 读权限的用户列表文件
2. writers:有 cvs 写权限的用户的列表文件
Note: 这两个文件必须以空行结束 添加CVS用户示例(jx具有写权限, jianfeng具有读权限)

1. 编辑CVSROOT/passwd 文件(cvsroot用户), 加入以下两行:
   jx:$fajkdpaieje:cvsroot
   jianfeng:fjkal;ffjieinfn/:cvsroot
   note: 上面的第二个字段(分隔符为:)是密文口令, 可以随便输入.
2. 使用如下的perl脚本生成密码,copy到CVSROOT/passwd文件中(第二个字段).
   #!/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";
3. 如果jx需要密码123456, 执行上面的脚本产生密文.
   ./passwdgen.pl 123456
   AWoU4Acdd8XLM(将此密文考到CVSROOT/passwd文件中)
4. 因为jianfeng具有读权限, 应将其加入readers文件.
   编辑readers文件,
   jianfeng
   (空行)
   
5. 因为jianfeng具有写权限, 应将其加入writers文件.
   编辑writers文件,
   jx
   (空行)

   note: writers中的用户不能在readers中 passwd, readers, writers缺省安装时不存在.

添加CVS项目

1. 进入到你的已有项目的目录, 比如:pds
   cd pds
   cvs import -m "PHS packet prototype" pds     pds_0_0_1     start  访问CVS服务器

1. export CVSROOT=:pserver:jx@135.252.143.225:/home/cvsroot
2. cvs login
   输入你的password成功登陆后,就$HOME生成一个.cvspass文件. 以后
   就不用再输入口令了.


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/43765/showart_344163.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2