设为首页 收藏本站
查看: 624|回复: 0

[经验分享] centos下安裝CVS及配置

[复制链接]

尚未签到

发表于 2016-5-10 09:04:45 | 显示全部楼层 |阅读模式
  Centos 中安裝CVS Server方法
  用過一段時間cvs,后来用SVN,現在都沒有印像了,故温习一下
  一、系统上是否已经安装相关的服务

1、cvs的安装

查看CVS的安装情况 写道

[qinshiqi@localhost Desktop]$ rpm -qa |grep cvs
lklug-fonts-0.6-4.20090803cvs.el6.noarch
libedit-2.11-4.20080712cvs.1.el6.x86_64
xdg-utils-1.0.2-17.20091016cvs.el6.noarch

 [qinshiqi@localhost Desktop]$ rpm -q xinetd
package xinetd is not installed
[qinshiqi@localhost Desktop]$ rpm -q cvs
package cvs is not installed

如果没有安装 ,则可用 yum install cvs安装,或者下载cvs单独安装

CVS下载地址,没有试过
http://download.iyunv.com/download/0001000/76.shtml

 但通过yum安装 的时候有问题请参考如何修改yum源以解决问题

http://qinshiqi.iyunv.com/admin/blogs/2036014
  然后在通过yum
  [iyunv@localhost yum.repos.d]# yum install cvs
Loaded plugins: fastestmirror, refresh-packagekit, security
……………………………………。
  Installed:
  cvs.x86_64 0:1.11.23-16.el6                                                  

Complete!
  验证cvs是否已经安装上了:
[iyunv@localhost yum.repos.d]# rpm -qa cvs
cvs-1.11.23-16.el6.x86_64
  
  参数|grep cvs与 cvs的区别:
  [iyunv@localhost Documents]# rpm  -qa |grep cvs
lklug-fonts-0.6-4.20090803cvs.el6.noarch
libedit-2.11-4.20080712cvs.1.el6.x86_64
xdg-utils-1.0.2-17.20091016cvs.el6.noarch
cvs-1.11.23-16.el6.x86_64
[iyunv@localhost Documents]# rpm  -qa cvs
cvs-1.11.23-16.el6.x86_64


  
  2、xinetd服务是否已经安装,如果没有安装,先安装上
  
  这个通过yum安装还是失败,干脆直接从安装盘上拷贝过来安装吧
  [iyunv@localhost ShareForVM]# rpm -ivh xinetd-2.3.14-38.el6.x86_64.rpm
Preparing...                ########################################### [100%]
   1:xinetd                 ########################################### [100%]
[iyunv@localhost ShareForVM]# rpm -qa xin
[iyunv@localhost ShareForVM]# rpm -qa xinetd
xinetd-2.3.14-38.el6.x86_64
  
  3,修改环境变量(目前不是必须的)
  $su root
  #vi /etc/profile
  在最后添加
  CVSROOT=/home/cvsroot
  exprot CVSROOT
  保存后,
  #source /etc/profile
  成功后,检查环境变量添加是否成功
  #echo $CVSROOT
  
  
二、CVS的配置
  
  1、设置用户
  

设置CVS用户 写道

创建用户组cvsg
[iyunv@localhost Documents]# groupadd cvsg
在这个组下增加用户cvsroot
[iyunv@localhost Documents]# useradd cvsroot -g cvsg
修改新加用户的密码c*_testr*_
[iyunv@localhost Documents]# passwd cvsroot
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
  
  2、建立CVS仓库并初始化
  [iyunv@localhost cvsroot]# pwd
/home/cvsroot
改变/home/cvsroot的目录属性
chmod 775 /home/cvsroot(/home/cvsroot目录需要至少给群组权限)

建立仓库 写道

[iyunv@localhost cvsroot]# chmod 775 /home/cvsroot
[iyunv@localhost cvsroot]# cvs -d /home/cvsroot init
[iyunv@localhost cvsroot]# ls
CVSROOT
[iyunv@localhost cvsroot]# cd CVSROOT/
[iyunv@localhost CVSROOT]# ls
checkoutlist config,v Emptydir modules,v taginfo
checkoutlist,v cvswrappers history notify taginfo,v
commitinfo cvswrappers,v loginfo notify,v val-tags
commitinfo,v editinfo loginfo,v rcsinfo verifymsg
config editinfo,v modules rcsinfo,v verifymsg,v
  3、创建登录cvs服务的用户以及密码
  [iyunv@localhost CVSROOT]# htpasswd -c passwd yfeifei
New password:
Re-type new password:
Adding password for user yfeifei
d*_****
在/home/cvsroot/CVSROOT下运行htpasswd -c passwd yfeifei
(-c 会生成passwd文件,以后再创建用户就不需要 -c 参数了,可以使用 -n 参数直接指定用户名,但要在passwd文件中添加对应的用户名称加密密码以及:cvsroot)
  
  (创建的feifei用户是以其所在群组为cvs的资格来可读可写可执行仓库中的文件)
  修改passwd文件,在用户名后边加上cvsroot
  *************************
  [iyunv@localhost CVSROOT]# htpasswd  passwd qin
New password:
Re-type new password:
Adding password for user qin
[iyunv@localhost CVSROOT]# cat passwd
yfeifei:7vV7AcR3pOORk:cvsroot
qishi:v8yvvdpJ71L7w:cvsroot
qin:9tTPnujUuKP82
[iyunv@localhost CVSROOT]# 
  

注意

qin后边必须加:cvsroot,

加这个的使用是CentOS系统将cvs用户与系统用户对应

 
  
  4、检查服务是否配置
  root@localhost ShareForVM]# more /etc/services |grep cvspserver
cvspserver      2401/tcp                        # CVS client/server operations
cvspserver      2401/udp                        # CVS client/server operations
  如果出现以上结果,说明配置成功,否则需要手动添加(vi /etc/services)
  这两行在cvs服务安装完成时就会存在,如果没有可以手动添加,我们可以清楚看到cvs服务的监听端口是默认的2401。
  修改cvspserver的监听端口,将2401改成与系统其他端口不冲突,自己喜欢的端口号就可以了。

修改方式 写道

.修改cvs服务监听端口
#vi /etc/services
修改cvspserver的监听端口,将2401改成与系统其他端口不冲突,自己喜欢的端口号就可以了。

重启xinetd服务
#service xinetd restart


 
  
  5修改cvs文件
  Linux的其他版本可能是cvspserver,没有时需要手动创建该文件,在我安装的centos6.3中,没有这个文件,网上说centos6默认应该是有的,不知为什么,先创建吧
  /etc/xinetd.d/cvs
  /etc/xinetd.d/cvspserver 
  
  # 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 \
#              between versions.
service cvspserver
{
        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
}
  
  6.重启xinetd服务
#service xinetd restart
  7、检查cvspserver服务是否已经启动:

[iyunv@localhost xinetd.d]# netstat -l|grep cvspserver
tcp        0      0 *:cvspserver                *:*                         LISTEN    

[iyunv@localhost xinetd.d]# netstat -lnp|grep 2401
tcp        0      0 :::2401                     :::*                        LISTEN      6804/xinetd        
 
8、客户端连接检查  
  [iyunv@localhost Documents]# cvs -d:pserver:cvsroot@XXX.28.146.116:/home/cvsroot login
Logging in to :pserver:cvsroot@172.28.146.116:2401/home/cvsroot
CVS password:
cvs [login aborted]: unrecognized auth response from 172.28.146.116: cvs pserver: cannot open /home/cvsroot/CVSROOT/config: Permission denied
  不知什么原因,所以先对这个目录授权/home/cvsroot
  [iyunv@localhost Documents]# chmod 755 -R /home/cvsroot
[iyunv@localhost Documents]# chown cvsroot:cvsg -R /home/cvsroot
  授权后也还是不行,出现一面的信息
[iyunv@localhost Documents]# cvs -d:pserver:cvsroot@XXX.28.146.116:/home/cvsroot login
Logging in to :pserver:cvsroot@XXX.28.146.116:2401/home/cvsroot
CVS password:
cvs [login aborted]: unrecognized auth response from XXX.28.146.116: cvs pserver: cannot open /home/cvsroot/CVSROOT/config: Permission denied

关于CVS中出现cannot open /cvsroot/xxx/CVSROOT/config: Permission denied的问题

 




  RedHat linux中有一个叫selinux的东西,它倒置了CVS读不到config文件,如果出现问题了就把selinux关了就好了..(个人感觉应该像是进程防火墙的意思,有机会再详细研究下,实际上关了好像不太好..)..
  
  关闭的方法: 
  #setenforce 0   
  这个每次机器重启后都需要在执行一下,否则又出现上面的问题
  
  SElinux以及防火墙的关闭
  关闭SELinux的方法:
  修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启。
  如果不想重启系统,使用命令setenforce 0
注:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
  在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux

A不重启设置# setenforce 0
重启后失效

B 需要重启Linux:
vi /etc/selinux/config 将SELINUX=enforcing 改成SELINUX=disabled

写道

[iyunv@localhost /]# getenforce
Permissive
[iyunv@localhost /]# setenforce 0
[iyunv@localhost /]# getenforce
Permissive
[iyunv@localhost /]# setenforce 1
[iyunv@localhost /]# getenforce
Enforcing

 
  

[iyunv@localhost /]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
 
把SELINUX=enforce   改成disabled就可以了,重启电脑,永久生效
  
  
  [iyunv@localhost CVSROOT]# cvs -d:pserver:cvsroot@XXX.28.146.116:/home/cvsroot login
Logging in to :pserver:cvsroot@XXX.28.146.116:2401/home/cvsroot
CVS password:
[iyunv@localhost CVSROOT]#
  
  三、centos防火墙
  
  
  
  查看运行的状态

[iyunv@localhost CVSROOT]# /etc/init.d/iptables status
iptables: Firewall is not running.

[iyunv@localhost CVSROOT]# service iptables status
iptables: Firewall is not running.

[iyunv@localhost CVSROOT]# /etc/init.d/iptables status
iptables: Firewall is not running.
[iyunv@localhost CVSROOT]# /etc/init.d/iptables start
iptables: Applying firewall rules:                         [  OK  ]
[iyunv@localhost CVSROOT]# /etc/init.d/iptables status
Table: filter
……………………

[iyunv@localhost CVSROOT]# /etc/init.d/iptables stop
  3、 打开iptables的配置文件直接修改,这个永久有效:
vi /etc/sysconfig/iptables
  直接安装22端口的设置复制一行,呵呵
  


  1、这个不起使用呀
  [iyunv@localhost CVSROOT]# chkconfig iptables
[iyunv@localhost CVSROOT]# chkconfig iptables  on
[iyunv@localhost CVSROOT]# service iptables status
iptables: Firewall is not running.
  2、  即时生效,重启后失效:
  开启: service iptables start
  关闭: service iptables stop
  这个起作用,


  需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。
  在开启了防火墙时,做如下设置,开启相关端口,
  修改/etc/sysconfig/iptables 文件,添加以下内容:
  -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
  -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
  
  -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
       -A INPUT -p tcp -m state --state NEW -m tcp --dport 2401 -j ACCEPT
  或者:
  /etc/init.d/iptables status 会得到一系列信息,说明防火墙开着。
  /etc/rc.d/init.d/iptables stop 关闭防火墙
  
建议的关闭防火墙命令是
  iptables -P INPUT ACCEPT
  iptables -P FORWARD ACCEPT
  iptables -P OUTPUT ACCEPT
  iptables -F
  
  
  
  3、 打开iptables的配置文件直接修改,这个永久有效:
vi /etc/sysconfig/iptables
  直接安装22端口的设置复制一行,呵呵
  
  然后#service iptables restart
  
  
  

写道

手工配置,感觉这个没有起作用
或者我们可以在CentOS操作系统使用命令:
#/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT
#sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT3
#etc/init.d/iptables save
测试这个不行,

 

写道

这两个目录
/sbin/iptables
/etc/init.d/iptables
[iyunv@localhost sbin]# /etc/init.d/iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
[iyunv@localhost sbin]# /etc/init.d/iptables start
iptables: Applying firewall rules: [ OK ]

[iyunv@localhost sbin]# service iptables start
[iyunv@localhost sbin]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
[iyunv@localhost sbin]# service iptables start
iptables: Applying firewall rules: [ OK ]

 
 
  

永久关闭防火墙 写道

永久关闭防火墙

我们也可以永久的关闭防火墙,但是我不建议大家这样做.永久关闭防火墙可以这样:
#chkconfig –level 35 iptables off
也可以直接修改
/etc/sysconfig/iptables
添加一条
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

这样,我们就介绍完了如何CentOS操作系统防火墙配置及关闭步骤.
  



 



 进一步了解CVS平台的使用

http://www.kuqin.com/cvsdocument/index.html#toc_Repository

 参考:

http://hi.baidu.com/xizenyin/item/ab91aa21fdcc47112a0f1c05

http://blog.iyunv.com/uid-20640366-id-1908902.html

 http://blog.sina.com.cn/s/blog_6d0d1c2c0100y20y.html

 http://www.doc88.com/p-971854762034.html

http://blog.sina.com.cn/s/blog_537a7ce301000awy.html

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-214949-1-1.html 上篇帖子: CentOS 6安全加固及性能优化 下篇帖子: CentOS 如何使用第三方软件库-EPEL与RPMForge、RPMFusion软件库
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表