CVS服务器
简单搭建
安装cvs就免了,一般服务器版本的linux都一经安装好CVS软件了。
1 建立cvs用户
groupadd cvs useradd -g cvs -G cvs -d /cvsroot cvsroot passwd cvsroot chmod 775 /cvsroot
2 初始化CVS源码库
cvs -d /cvsroot init
3 创建可以登录的CVS用户密码文件
vim /cvsroot/CVSROOT/passwd
在passwd文件中添加用户名和密码等信息
jianlee:gYKjOK.81zhFo:cvsroot
中间部分的"gYKjOK.81zhFo"就是加密的密码,可以用下面脚本得到:
#!/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";
例如我们想使用"123456"作为"jianlee"用户的密码:
./genpasswd.pl "123456" gYKjOK.81zhFo
把"gYKjOK.81zhFo"拷贝到passwd文件行的中间就可以了。
4 配置CVS服务器启动
cat /etc/xinetd.d/cvs
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
server_args = -f --allow-root=/cvsroot pserver
# bind = 127.0.0.1
}
把disable改为no,—allow-root字段换成自己的仓库目录。重启xinetd服务:
/etc/init.d/xinetd restart
查看服务启动情况:
$ netstat -lnp|grep 2401 (No info could be read for "-p": geteuid()=501 but you should be root.) tcp 0 0 0.0.0.0:2401 0.0.0.0:* LISTEN -
5 现在在客户端测试
export CVS_RSH=ssh export CVSROOT=:pserver:用户名:@CVS服务器:/cvsroot cvs login # 登录 cvs import -m "这是CVS项目测试" cvstest v_0_0_1 start #上传当前目录作为cvstest项目
登录过过程中有任何错误需要查看CVS服务器端的iptables和selinux设置。
