随笔 - 171  文章 - 257  trackbacks - 0
<2006年1月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(33)

随笔分类(225)

随笔档案(171)

相册

技术

友情链接

最新随笔

搜索

  •  

积分与排名

  • 积分 - 441162
  • 排名 - 48

最新随笔

最新评论

阅读排行榜

评论排行榜

CVS 服务器的安装配置以及使用 redhat9

作者: Khan
时间: 2006-1-9
环境: 服务器 Redhat 9.1  ,客户端 :window 2000 pro

因为有个项目要多人合作,所以选择了cvs, 其实有其他选择,如subversion,但是资料少所以只有使用这个
早上9:00 - 15:00 终于配置完了服务器端和客户端,并建立了一个仓库使用,就将一些安装使用的心得归纳
了下来

一 CVS服务器的安装:
1.查看你的操作系统上是否安装了CVS:
#> rpm -qa|grep cvs

2.建立cvs用户组:

#> groupadd cvs

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

#> useradd cvsroot -g cvs

4.为cvsroot用户添加密码:

#> passwd cvsroot

5.改变 /cvsroot/ 的目录属性:

#> chmod –R 770 /cvsroot

6.改变用户登陆身份:

#> su cvsroot

7.开始创建单个项目:

#> cd /home/cvsroot
#> mkdir smscgw
#> mkdir smgp

8.开始建立仓库:
这里我建立了两个仓库,用以介绍用户名,密码的设置方法
cvs –d /home/cvsroot/smscgw init
cvs –d /home/cvsroot/smgp init
#> chmod –R 770 ./smscgw/ ./smgp/

9.建立CVS服务启动文件,我们使用xinetd方式:

#> su - root 切换到root用户身份
#> cd /etc/xinetd.d
#> vi cvspserver

service cvspserver
{
  disable = no
  flags = REUSE
  socket_type = stream
  wait = no
  user = root
  server= /usr/bin/cvs
  server_args= -f --allow-root=/home/cvsroot/smscgw --allow-root=/home/cvsroot/smgp pserver
  log_on_failure += USERID
}

10.加入cvs服务:

#>vi /etc/services

cvspserver 2401/tcp #pserver cvs service
cvspserver 2401/udp #pserver cvs service
11。启动cvs服务:

#> /etc/init.d/xinetd restart

12.检查cvspserver服务是否已经启动:

#> netstat -l |grep cvspserver
应该有如下结果:

tcp 0 0 *:cvspserver *:* LISTEN


二.CVS服务的用户管理:
1.创建可以登陆cvs服务器的用户名和密码:

#> su cvsroot
#> vi /home/cvsroot/smscgw/CVSROOT/passwd

trotter:*****:cvsroot
mimi:*****:cvsroot

#>vi /home/cvsroot/smgp/CVSROOT/passwd

trotter:*****:cvsroot
gary:*****:cvsroot

这两个文件的意思是有trotter,mimi,gary三个cvs用户,mimi拥有smscgw的使用权限,gary拥有smgp的使用权限,trotter拥有project1和project2的使用权限。登陆后的权限是cvsroot权限。
注意:这里的cvs用户和系统用户是不同的。

2.*****为密码,由以下文件生成:

#> vi /home/cvsroot/smscgw/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}
";

#>chmod a+x ./passwd.pl

3.如果你想生成一个密码是"123456",则:

#> /cvsroot/passwd.pl "123456"

回车即可得到加密密码,用其替换passwd文件中的*****

4.配置仓库
以smscgw仓库为例
#> cvs –d /home/cvsroot/smscgw init 这个指令执行成功的话,会产生/home/cvsroot/smscgw/CVSROOT这个目录

编辑modules模块文件(直接在服务器上用vi编辑,也可以用cvs客户端将CVSROOT导出后,本地编辑,然后提交)
#> vi /home/cvsroot/smscgw/CVSROOT/modules

# Three different line formats are valid:
#    key    -a    aliases...
#    key [options] directory
#    key [options] directory files...
#
#      模块名   [options]  
       SMSCGW    -a         smscgw3

# 其他选项
# Where "options" are composed of:
#    -i prog        Run "prog" on "cvs commit" from top-level of module.
#    -o prog        Run "prog" on "cvs checkout" of module.
#    -e prog        Run "prog" on "cvs export" of module.
#    -t prog        Run "prog" on "cvs rtag" of module.
#    -u prog        Run "prog" on "cvs update" of module.
#    -d dir        Place module in directory "dir" instead of module name.
#    -l        Top-level directory only -- do not recurse.
#
# NOTE:  If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias.  An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module.  This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.


三.使用

1.将本地工程导入到远程仓库
以windows 下的cvs客户端为例,我使用的是TortoiseCVS 这个软件,一个嵌入Explorer的客户端
在你需要导入到服务器的工程目录上点鼠标右键,选择 cvs-->创建新模块
选择协议,输入帐号密码,端口,仓库文件夹,模块名
也可以选择在CVSROOT输入框中输入:pserver:username:password@ip:port/home/cvsroot/repository/smscgw
注意目录结构父目录和子目录最好不要重名,也就是说最好不要出现 smscgw/smscgw这样的目录结构

输入完以后选择 "确定"
成功导入,该文件夹会有一个绿色的小标志,进入该目录,鼠标右键 "CVS添加",将需要导入的文件添加到仓库

2.将远程仓库导出到本地

在任何一个目录下 鼠标右键 CVS取出
输入相应的信息, 选择"确定"
posted on 2006-01-12 09:53 Khan 阅读(1010) 评论(0)  编辑 收藏 引用 所属分类: 周边技术

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理