wiflish
Loving Life! Loving Coding!
posts - 98,comments - 98,trackbacks - 0
1、删除系统自带的cvs
      rpm -e cvs
2、安装cvs(设定cvs安装在/usr/cvs,cvs仓库目录为/opt/cvsroot)
http://ximbiot.com/cvs/wiki/index.php?title=Main_Page#CVS_Downloads下载最新cvs源代码包cvs-1.11.22.tar.gz

tar -zxvf cvs-1.11.22.tar.gz

cd cvs-1.11.22
./configure --prefix=/usr/cvs
make
make install
ln /usr/cvs /usr/bin/cvs
3、创建cvs用户和用户组
groupadd cvs
useradd cvsroot
passwd cvsroot
输入cvsroot用户密码

4、初始化cvs仓库
该操作需要在cvsroot用户下执行
su -u cvsroot
cvs -d /opt/cvsroot init
exit(退出cvsroot用户,进入root用户)

5、修改系统环境变量
vi /etc/profile
在文件末尾增加:
CVSROOT=/opt/cvsroot;export CVSROOT
保存退出。
更新环境变量:
source /etc/profile

6、启动CVS服务
vi /etc/xinetd.d/cvspserver,内容如下:
 # default: on
# description: The cvs server sessions;

service cvspserver
{
socket_type = stream
wait = no
user = root
server = /usr/bin/cvs

server_args = -f --allow-root=/opt/cvsroot pserver

#only_from = 192.168.0.110/24  #限制访问
}
保存退出。

chmod 644 /etc/xinetd.d/cvspserver
/etc/rc.d/init.d/xinetd restart
netstat -lnp | grep 2401 #查看cvs服务是否已启动,启动成功则出现如下字样:
tcp        0      0 0.0.0.0:2401                0.0.0.0:*                   LISTEN      xxxxx/xinetd

7、建立cvs用户
vi /opt/cvsroot/CVSROOT/config
查找#SystemAuth,并更改为:SystemAuth=no 
#该更改的意思是不检查操作系统的用户名和密码,避免安全问题。

更改/opt/cvsroot目录权限:
chmod -R ug+rwx /opt/cvsroot
chmod 644 /opt/cvsroot/CVSROOT/config

建立密码生成脚本文件:
vi /opt/cvsroot/CVSROOT/passwordgen.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}\n"; 
保存退出。
chmod 740 /opt/cvsroot/CVSROOT/passwordgen.pl
执行 /opt/cvsroot/CVSROOT/passwordgen.pl "test" 就能得到test的加密字串。

建立passwd文件:
vi /opt/cvsroot/CVSROOT/passwd,内容格式样式如下:
cvsroot:$1$yrf/5TD/$9QmhHgjiy.k.WcMyWEqNy1:cvsroot
test:eLkyeXuIWlQew:cvsroot
保存退出。
#passwd文件说明:passwd文件为cvs所使用的用户文件,分三部分(冒号分隔):
第一部分为用户名,第二部分为密码(该MD5加密密码字串可由上面passwordgen.pl脚本获得),第三部分为映射到对应的操作系统用户(从而实现权限管理)。

8、为用户分配权限
在/opt/cvsroot/CVSROOT目录下,建立readers和writers2个文件。
只读权限的用户加入readers文件,可写权限用户加入writers文件。
注意,readers文件比writers优先,也就是说出现在readers中的用户将会是只读的,不管writers文件中是否存在该用户。

9、测试
cvs -d :pserver:cvsroot@192.168.0.110/opt/CVSROOT login
输入cvsroot用户密码,如果没有任何错误信息,则登录成功。
注:192.168.0.110为cvs服务器地址。





posted on 2007-01-17 15:34 想飞的鱼 阅读(1706) 评论(0)  编辑  收藏 所属分类: linux

只有注册用户登录后才能发表评论。


网站导航: