redhat 6.5 更换yum源

新安装了redhat6.5.安装后,登录系统,使用yum update 更新系统。提示:

Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can us e subscription-manager to register.

1.删除redhat自带的yum包

[root@localhost ~]# rpm -qa |grep yum |xargs rpm -e --nodeps
[root@localhost ~]# rpm -qa |grep yum

2.下载新的yum包。使用Centos6.5的yum包

1)查看系统类别

root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)

2)下载新的yum包。使用Centos6.5的yum包

[root@localhost ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

[root@localhost ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm

[root@localhost ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

[root@localhost ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

3)安装

[root@localhost ~]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm python-urlgrabber-3.9.1-11.el6.noarch.rpm
warning: yum-metadata-parser-1.1.2-16.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
file /usr/lib/python2.6/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/grabber.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyc from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
file /usr/lib/python2.6/site-packages/urlgrabber/progress.pyo from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch
[root@localhost ~]# file /usr/lib/python2.6/site-packages/urlgrabber/grabber.py from install of python-urlgrabber-3.9.1-11.el6.noarch conflicts with file from package python-urlgrabber-3.9.1-9.el6.noarch

报错

查找问题,是python-urlgrabber引起的,要删除掉旧的包

rpm -e python-urlgrabber-3.9.1-9.el6.noarch

安装 rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm

再安装

[root@localhost ~]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
warning: yum-metadata-parser-1.1.2-16.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 33%]
2:yum-plugin-fastestmirro########################################### [ 67%]
3:yum ########################################### [100%]
[root@localhost ~]#

  4)更换yum源,将原有源删除或备份到别的目下下:
        #cd /etc/yum.repos.d/
        #wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
       #vi CentOS6-Base-163.repo
        编辑文件,把文件里面的$releasever全部替换为版本号:6(注意,不是6.5!)最后保存!

       :%s/$releasever/6/g 
3.清除原有缓存,重建缓存:
    #yum clean all
    #yum makecache
    

参考资源:

http://blog.sina.com.cn/s/blog_439628be0102woxd.html

https://blog.csdn.net/zhaihaifei/article/details/54616840

原文地址:https://www.cnblogs.com/your568/p/12033294.html