CentOS 5.3配置软件源以及CVS服务器
1、安装完CentOS 5.3之后,首先要保证可以上网,安装完SSH,并且打开。2、设置软件源
1)、CentOS的网络源配置文件是:
/etc/yum.repos.d/ 下的 CentOS-Base.repo
本文提供其 5.3版本的:网通,电信,第三方,163源各一个
配置方法一般是:
① .进入到repos.d目录
$ cd/etc/yum.repos.d
$ ls -l
总计 24
-rw-r--r-- 1 root root 802 2009-09-02CentOS-Base.repo
-rw-r--r-- 1 root root 626 03-17 09:30 CentOS-Media.repo
② .备份原来的源
$ mv CentOS-Base.repo CentOS-Base.repo.backup
③ .用下面的内容,重新生成CentOS-Base.repo
④ .$ yumupdate
2)、广泛应用的CentOS的软件源
① .国内某大学源(电信网通皆可使用)
name=CentOS-5 – Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5.3/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos6
#released updates
name=CentOS-5 – Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5.3/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build but not released
name=CentOS-5 – Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5.3/addons/$basearch/
② . 国内电信源
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOSupdates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
name=CentOS-$releasever – Base
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#released updates
name=CentOS-$releasever – Updates
baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
name=CentOS-$releasever – Addons
baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
name=CentOS-$releasever – Extras
baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
name=CentOS-$releasever – Plus
baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
③ . 第三方源配置
在服务器构建的过程中,我们将要用到的一些工具不存在于CentOS中yum的官方库中,所以需要定义yum的非官方库文件,让一些必需的工具通过yum也能够安装。
#vi /etc/yum.repos.d/dag.repo ← 建立dag.repo,定义非官方库,内容如下5行:
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
# rpm –importhttp://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt ← 导入非官方库的GPG
或者有下面这种方式
#设置rpmforge源
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
④ .163的源也还不错,网易网聚人的力量,确实是我们的好朋友
#添加163源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.save
mv /etc/yum.repos.d/CentOS-Media.repo /etc/yum.repos.d/CentOS-Media.repo.save
cp /etc/yum.repos.d/CentOS-Base.repo.save /etc/yum.repos.d/163.repo
sed -i "s/mirror.centos.org/mirrors.163.com/g"/etc/yum.repos.d/163.repo
sed -i "s/^mirrorlist/#mirrorlist/g" /etc/yum.repos.d/163.repo
sed -i "s/^#baseurl/baseurl/g" /etc/yum.repos.d/163.repo
3)、问题
在配置过程中,有可能会出现
GPG key retrieval failed: HTTP Error 404: NotFound
这个问题,这时只要修改repo使所有的gpgcheck=0就可以了。
3、安装版本服务器---CVS
1)、检查CVS软件默认是否安装好了。
通过使用rpm –qi cvs来查看
2)、如果没有安装,那么就需要安装
① .软件管理器yum的安装方式
yuminstall cvs
3)、创建用户和用户组
root用户下执行以下命令:
#adduser cvsbestcar
#passwd cvsbestcar 输入新密码
这里创建了bestcar这个用户,同时创建了bestcar这个用户组。
4)、创建CVS资源库的根目录
root用户下执行:
#mkdir /bestcar 此处可改为你想要的cvsroot路径
#chown cvsbestcar.cvsbestcar /bestcar 把cvs根目录的所属用户设置为cvsbestcar,所属组设为cvsbestcar。
5)、初始化cvs资源库
#su– cvsbestcar 切换到cvsbestcar这个用户
#cvs -d /bestcarinit
在/ bestcar目录下会生成CVSROOT这个子目录
<!-- ><v:shape id="_x0000_i1027" type="#_x0000_t75" style='width:415.5pt;height:112.5pt'> <v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\10\clip_image003.png"o:title=""/></v:shape><!--><!-- --><!-- -->
6)、修改环境变量CVSROOT
#exit
从cvsbestcar用户退回到root用户,只有root用户才有权限修改/etc/profile
#vim/etc/profile
编辑/etc/profile文件,在末尾加上以下两句:
CVSROOT=/cvsroot
export CVSROOT
#source /etc/profile
更新环境变量,此时系统已经认识$CVSROOT这样的环境变量
#echo $CVSROOT
检查是否设置成功,如果出现自己设置的路径,表示成功。
7)、修改服务器配置
在/etc/xinetd.d/下找到 cvs文件,修改成下面这样
servicecvspserver
{
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
passenv = PATH
server = /usr/bin/cvs
env = HOME=/bestcar
server_args = -f --allow-root=/bestcar pserver
# bind = 127.0.0.1
}
<!-- ><v:shape id="_x0000_i1028" type="#_x0000_t75" style='width:414.75pt;height:206.25pt'> <v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\10\clip_image005.png"o:title=""/></v:shape><!--><!-- --><!-- -->
8)、启动cvs服务
#/etc/rc.d/init.d/xinetd restart 重启动xinetd服务,需要注意,这个服务centos5默认并不安装,需要定制安装一下。
# netstat-lnp|grep 2401
tcp 0 0 0.0.0.0:24010.0.0.0:* LISTEN xxxxxx/xinetd
则说明cvs服务器已经运行。
PS. 如果发现没有输出,那么就证明配置有问题,可通过如下方式:
① .将第七步里面的disable=yes更改成disable=no
② . #/etc/rc.d/init.d/xinetd restart
③ .通过chkconfig --list 查看运行状态
<!-- ><v:shape id="_x0000_i1029" type="#_x0000_t75" style='width:387pt;height:227.25pt'> <v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\10\clip_image007.png"o:title=""/></v:shape><!--><!-- --><!-- -->
④ .通过进程是看不到的,因为你的是通过xinitd来运行 ,也就是只有当客户端连接这个端口时cvs才会启动,所以通常是通过netstat -an | less来查看端口的状态的。
<!-- ><v:shape id="_x0000_i1026" type="#_x0000_t75" style='width:415.5pt;height:187.5pt'> <v:imagedata src="file:///C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\msohtml1\10\clip_image009.png"o:title=""/></v:shape><!--><!-- --><!-- -->
9)、注意要打开防火墙的2401端口,否则客户端还是连不上这个cvs的服务器。
10)、增加新用户。
用root
#cd /
#chmod -R 775cvsroot 让cvsroot组的所有成员都可以对cvs资源库目录的读写权限
#useradd -gcvsroot user0 创建新用户user0,并且将其添加进入cvsroot用户组
#passwduser0 设置好密码
11)、客户端连接
在客户端安装CVS,服务器端的IP为:192.168.12.241,然后在客户端输入
cvs-d :pserver:user0@192.168.12.241/bestcar login
① .错误提示为/bestcar/CVSROOT/config: Permission denied
自己本身的用户user0已经加入到组中,并且组对/bestcar文件可读可写
② . 错误提示为:
cvs login: CVS password file /home/wq/.cvspass does not exist -creating a new file
该问题就是在客户端登录时要在HOME目录下有个.cvspass的文件即可。因此,解决方法就是在/home/wq/下:
页:
[1]