1、问题描述
解决RedHat6.9下yum功能不能用问题:
在redhat6.9下使用yum安装时,会提示:This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
由于centos6.9和redhat6.9版本一致,所以可以卸载原有yum,用centos6.9的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*
配置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