1、 建立一个CVS用户组
groupadd cvs
2、 建立CVS组的cvsroot用户和所属的目录
useradd –g cvs –G cvs –d/home/cvsroot cvsroot
3、 为cvsroot用户添加密码
passwd cvsroot 注意:这里相当于是给一个系统用户加密码,应该来说加不加无所谓的,但没有试过不加的。
4、 改变/home/cvsroot的目录属性
chmod 775 /home/cvsroot
5、 初始化CVS源码库,这里就相当于建了一个仓库,可以看到在些操作的执行目录下多了一个CVSROOT的目录,里面放了一些初始化文件。
cvs –d /home/cvsroot/code init
注意:这里初始化文件的位置在/home/cvsroot/code/CVSROOT,这步用cvsroot用户操作
6、 创建可以登陆到CVS服务的用户及密码,创建passwd文件
有两种办法可以创建passwd文件,创了文件,在文件里加了用户,这个用户也就是CVS用户了
1、vi /home/cvsroot/code/CVSROOT/passwd
文件内容:
用户名:密码:cvsroot
这里的密码是可识别的,不安全。下面可以用一段程序passwdgen.pl,来把它变为不可识别的,然后粘贴到passwd文件里密码的位置。当然这个passwdgen.pl是自已写的一个程序,位置放上/home/cvsroot/code/passwdgen.pl这里我觉得未必一定要放在这里,但没试过放其它地方。Passwdgen.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";
2、用命令:
htpasswd passwd 用户名 回车
输两遍密码
就产生了passwd文件了,打开产生的文件在用户名密码后添上一个:cvsroot,该用户就可以用了。
7、 加入CVS服务
more /etc/services
如果文件里有这两行
cvspserver 2401/tcp #pserver cvs service
cvspserver 2401/udp #pserver cvs service
就不用加入了,如果没有就用vi 加入。
8、 cvs服务有两种唤起方式:inted 和xinetd.d,这可以在系统工具-服务 里查看,redhat9默认的是xinetd.d
inted方式:在/etc/inetd.conf方件中加入
# CVS pserver (remote acces to your CVS repositories)
# Please read the section on security and passwords in the CVS manual,
# before you enable this.
cvspserver stream tcp nowait root /usr/sbin/tcpd /usr/bin/cvs -f --allow-root=/
home/cvsroot/jxt --allow-root=/home/cvsroot/test --allow-root=/home/cvsroot/doc
ument --allow-root=/home/cvsroot/code pserver
xinetd.d方式在/etc/xinetd.d目录里新建一个cvspserver文件,文件内容如下:
service cvspserver
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
#bind= 218.206.70.230
server = /usr/bin/cvs
server_args = -f --allow-root=/home/cvsroot/code --allo
w-root=/home/cvsroot/document --allow-root=/home/cvsroot/ussd --allow-root=/home
/cvsroot/info pserver
log_on_failure += USERID
#only_from = 192.168.0.0/24
}
9、 重新启动inetd或者xinetd:
/etc/rc.d/init.d/xinetd restart
10、 检查cvspserver服务是否已经启动
netstat –l |grep cvspserver
结果如下
tcp 0 0 *:cvspserver *:* LISTEN 正常
完成了,不行了话仔细检查上面的东西。当然要有没遇到过的情况还得别想办法了。
可以由客户端登陆了。