版本控制CVS服务器的搭建
1. 安装:
1) 查看本机是否已安装CVS包:
#rpm –qa | grep cvs
#which cvs
2) if not install cvs rpm, build it:
i. #rpm –ivh cvs-x-x.i386.rpm
ii. Binary source tar
#tar xzvf
#./configure
#make
#make install
2. 配置CVS服务器
1)#mkdir /home/src
#cvs –d /home/src init
/* 在/home/src下生成了CVSROOT目录表示执行成功 */
2)
#groupadd cvsuser
#useradd usera –g cvsuser
#passwd usera
3)修改目录权限
#chgrp cvsuser /home/src –R
#chmod 775 /home/src
4)vi /etc/xinetd.d/cvsserver
Service cvspserver
{
Port = 2401
Socket_type = stream
Wait = no
User = root
Server = /usr/bin/cvs
Server_args = --allow-root=/home pserver /* cvs 是由pserver服务支持的 */
Only_from = 192.168.1.0/24 /* 用来控制访问权限 */
}
5) #/etc/init.d/xinetd restart
6)查看xinetd是否启动
Ps –ef | grep xinetd
3. CVS客户端配置及常用命令
#export CVSROOT=:pserver:user@server:/home/src
/*
* pserver 是访问方式,口令认证的意思
* user是CVS的用户名
* server是CVS服务器的名称or IP
* /home/src是CVSROOT所在的路径
*/
可以把环境变量写在/etc/profile里;
4. 登陆CVS 服务器及常用命令
#cvs login
#cvd import –m “write some comments here” project_name vendor_tag release_tag
/* check out project */
#cvs co MyProject
/* cvs update file 要养成“先同步后修改的好习惯” */
/* 在check out 后,有人又添加了新的文件或目录,你需要把他们取出来 */
#cvs update –d
/* 如果已经修改了本地的文件,又不想提交了,想重新取得新的文件 */
#cvs update –C filename
/* 提交修改 */
#cvs add README
#cvs ci
/* del file */
#cvs remove –f README
#cvs ci
/* 分支管理 */
#cvs tag TAG_NAME
/* 删除标签 */
#cvs tag –d TAG_NAME
/ *标签改名* /
#cvs tag –r TAG_NAME_OLD TAG_NAME_NEW
/* 根据标签提取代码 */
#cvs co –r TAG_NAME MyProject
/* 根据标签更新 */
#cvs update –r TAG_NAME
/* 个别文件退回,版本返回 */
#cvs –Q update –p –r 1.1 foo.c>foo.c
/* 项目退回 */
#cvs up –j HEAD –j TAG_NAME