在安装heartbeat的时候提示不能找到依赖的包,最后发现是yum源的问题。在网上查了很多资料,终于成功配置了yum网络源,下面分享一下解决的办法。

解决办法:

1.卸载EHEL的yum,并下载CentOS的对应软件包

[root@heartbeat-1-127 tools]# rpm -aq|grep yum
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-rhn-plugin-0.9.1-58.el6.noarch
yum-3.2.29-69.el6.noarch
[root@heartbeat-1-127 tools]# rpm -aq|grep yum|xargs rpm -e --nodeps
[root@heartbeat-1-127 tools]# 
[root@heartbeat-1-127 tools]# rpm -aq|grep yum|xargs rpm -e --nodeps
rpm: no packages given for erase

2.下载并安装CentOS的对应的软件包

(1)可以通过网站直接下载

http://mirrors.163.com/centos/6/os/x86_64/Packages/

(2)在线下载对应软件包

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
[root@heartbeat-1-127 ~]# cd /home/linzhongniao/tools/
[root@heartbeat-1-127 tools]# ls
yum-3.2.29-81.el6.centos.noarch.rpm  python-iniparse-0.3.1-2.1.el6.noarch.rpm   yum-metadata-parser-1.1.2-16.el6.x86_64.rpmpython-urlgrabber-3.9.1-11.el6.noarch.rpm  yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm

提示:如果不正确执行,网站没有响应,意思这个包找不到了,以前版本更新了老版本删除掉了,我们可以按原来的软件名,在上面的那个网站里找这些安装包。

(3)安装对应软件包

[root@heartbeat-1-127 tools]# rpm -ivh *

每个人的系统环境都不一样,安装过程中会遇到各种各样的问题。缺失依赖的软件包rpm安装或者在镜像源网站上下载安装即可,如果提示软件包冲突rpm –e卸载旧版本重新在镜像源网站上下载安装即可。

3.Yum网络源配置

(1)先备份系统.repo文件

[root@heartbeat-1-127 ~]# cp /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo.bak

(2)添加下面内容

[root@heartbeat-1-127 yum.repos.d]# cat rhel-source.repo
[base]
name=CentOS-$releasever - Base
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-$releasever - Updates
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-$releasever - Extras
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0

(3)清除原来的源文件

`yum clean all` 

(4)安装yun源,测试新的yum 源有没有安装成功

 yum install yum

(5)获取yum列表

yum list

好,到此yum网络源的配置成功了