(说明:斜线部分是输入的命令)
——————————————————————————————————- CentOS版本:
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: CentOS
Description: CentOS release 5.5 (Final) Release: 5.5 Codename: Final CVS版本: cvs-1.11.22-7.el5
——————————————————————————————————- 1、安装
先确认系统中是否已经安装cvs [root@www ~]# rpm -qa|grep cvs
无显示则说明没有安装,如果安装过会出现类似这样的结果: [root@www ~]# rpm -qa|grep cvs cvs-1.11.22-7.el5 yum方式安装cvs:
[root@www ~]# yum -y install cvs Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies –> Running transaction check
—> Package cvs.i386 0:1.11.22-7.el5 set to be updated –> Finished Dependency Resolution Dependencies Resolved
============================================================================================================================= Package Arch Version Repository Size ============================================================================================================================= Installing:
cvs i386 1.11.22-7.el5 base 725 k Transaction Summary
================================================================
============================================================= Install 1 Package(s) Upgrade 0 Package(s) Total download size: 725 k Downloading Packages:
cvs-1.11.22-7.el5.i386.rpm | 725 kB 00:08 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction
Installing : cvs Installed:
cvs.i386 0:1.11.22-7.el5 Complete! 到此安装结束。 2、用户设置: 添加cvs组:
[root@www ~]# groupadd cvs
添加cvsroot用户,同时指定主目录和所属组:
[root@www ~]# useradd -G cvs -d /home/cvsroot/ cvsroot 给cvsroot设置一个密码: [root@www ~]# passwd cvsroot 修改相关目录的权限:
[root@www ~]# chown cvsroot:cvs /home/cvsroot/ [root@www ~]# chmod 775 /home/cvsroot/
初始化cvs数据仓(注:要su到cvsroot用户操作): [root@www ~]# su cvsroot
[cvsroot@www root]$ cvs -d /home/cvsroot/ init 退回root权限:
[cvsroot@www root]$ exit exit
3、CVS配置:
修改cvs的配置文件(修改了 disable、env和server_args三行): [root@www ~]# vi /etc/xinetd.d/cvs # default: off
# description: The CVS service can record the history of your source \\ # files. CVS stores all the versions of a file in a single \\ # file in a clever way that only stores the differences \\
1/1 # between versions. service cvspserver {
# disable = yes disable = no port = 2401 socket_type = stream protocol = tcp wait = no user = root passenv = PATH server = /usr/bin/cvs
# env = HOME=/var/cvs env = HOME=/home/cvsroot
# server_args = -f –allow-root=/var/cvs pserver server_args = -f –allow-root=/home/cvsroot pserver # bind = 127.0.0.1 }
4 CentOS系统修改/etc/services加入 cvspserver 2401/tcp #pserver cvs service
5、启动:
[root@www ~]# /etc/rc.d/init.d/xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ] 查看2401是否已经启用:
[root@www ~]# netstat -an |grep 2401
tcp 0 0 0.0.0.0:2401 0.0.0.0:* LISTEN 6 添加用户:
CentOS系统添加cvs用户.在/home/cvsroot/CVSROOT下运行htpasswd -c passwd test 将新建一个叫做passwd的文件并且提示输入密码,密码经过md5加密放入passwd文件.以后新加用户不用-c.
7 .CentOS系统将cvs用户与系统用户对应. vi passwd
每个用户那行最后添加:cvsroot 例如:test:xxxx:cvsroot
这样,我们就完成了在CentOS系统中建立cvs server的步骤。
8、测试: 登录:
[root@www ~]# cvs -d :pserver:cvsroot@localhost:/home/cvsroot/ login Logging in to :pserver:cvsroot@localhost:2401/home/cvsroot 登出: CVS password:
[root@www ~]# cvs -d :pserver:cvsroot@localhost:/home/cvsroot/ logout Logging out of :pserver:cvsroot@localhost:2401/home/cvsroot [root@www ~]#
因篇幅问题不能全部显示,请点此查看更多更全内容