1、问题描述
解决RedHat6.5下yum功能不能用问题:
在redhat6.5下使用yum安装时,会提示:This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
由于centos6.5和redhat6.5版本一致,所以可以卸载原有yum,用centos6.5的yum替代
注意:配置之前做好域名解析,修改:/etc/resolv.conf
在文件末尾加入:
nameserver 114.114.114.114
nameserver 8.8.8.8
如下所示:
-bash-4.1$ cat /etc/resolv.conf
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 8.8.8.8
nameserver 114.114.114.114
2、解决办法
2.1 卸载原生yum
查看已安装yum版本
rpm -qa|grep yum
卸载已安装yum
rpm -qa|grep yum|xargs rpm -e --nodeps
创建rpm包存放文件夹
mkdir /opt/yum-package
2.2 安装新yum
下载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-3.2.29-81.el6.centos.noarch.rpm wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm 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
安装相关rpm包
rpm -ivh yum* rpm-ivh python*
配置yum源(这里使用的是164的yum源)
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
备份原有yum源
mv rhel-source.repo rhel-source.repo.bak
将CentOS6-Base-163.repo文件中的所有的$releaserver替换为6
sed -i "s#\$releasever#6#g" CentOS6-Base-163.repo
2.3 重建yum
重建yum
yum clean all yum makecache
3、报错
如果出现报错:
FatalPythonerror:pycurl: libcurl link-time version is older than compile-time version
解决办法:
经过查资料,发现问题是环境配置造成的;于是,在 /etc/profile 最后写入:
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/usr/local/VMProg/lib:/usr/local/VMProg/lib/vmware-vix-disklib/lib64:/lib64:${LD_LIBARY_PATH}
然后,source /etc/profile,使环境生效,即可解决