Redhat6.5更改yum源

redhat默认自带的yum源需要注册,才能更新,报错:
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

今天试了一下,替换为centos对应的源。

先看了一下yum所有的包,其中提供yum命令的是yum-3.2.29-81.el6.centos.noarch包。

[root@localhost ~]# rpm -qf /usr/bin/yum
yum-3.2.29-81.el6.centos.noarch

网上说只删除subscription-manager这个包就可以了,本次没有验证。本次是把yum和subscription-manager包同时删除了,顺便试试自己能否修复。^^

[root@localhost ~]# rpm -e yum
error: Failed dependencies:
	yum is needed by (installed) rhn-client-tools-1.0.0.1-16.el6.noarch
	yum >= 3.0 is needed by (installed) PackageKit-yum-plugin-0.5.8-21.el6.x86_64
	yum >= 3.2.19 is needed by (installed) PackageKit-yum-0.5.8-21.el6.x86_64
	yum >= 3.2.19-15 is needed by (installed) yum-rhn-plugin-0.9.1-48.el6.noarch
	yum is needed by (installed) python-meh-0.12.1-3.el6.noarch
	yum >= 3.2.19-15 is needed by (installed) subscription-manager-1.9.11-1.el6.x86_64
	yum >= 3.2.18 is needed by (installed) yum-plugin-security-1.1.30-14.el6.noarch
	yum >= 3.2.29 is needed by (installed) yum-utils-1.1.30-14.el6.noarch
[root@localhost ~]# rpm -e subscription-manager
error: Failed dependencies:
	subscription-manager = 1.9.11-1.el6 is needed by (installed) subscription-manager-gui-1.9.11-1.el6.x86_64
[root@localhost ~]# rpm -e yum --nodeps

各种依赖关系,只能强制删除yum了,删除之后再测试,果然没有yum命令了。

[root@localhost ~]# yum repolist
-bash: /usr/bin/yum: No such file or directory

对于subscription-manager,简单粗暴的一删到底。对不起了,redhat……^^

[root@localhost ~]# rpm -e subscription-manager
error: Failed dependencies:
	subscription-manager = 1.9.11-1.el6 is needed by (installed) subscription-manager-gui-1.9.11-1.el6.x86_64
You have new mail in /var/spool/mail/root
[root@localhost ~]# rpm -e subscription-manager-gui-1.9.11-1.el6.x86_64
error: Failed dependencies:
	subscription-manager-gui = 1.9.11-1.el6 is needed by (installed) subscription-manager-firstboot-1.9.11-1.el6.x86_64
[root@localhost ~]# rpm -e subscription-manager-firstboot-1.9.11-1.el6.x86_64
[root@localhost ~]# rpm -e subscription-manager-gui-1.9.11-1.el6.x86_64
You have new mail in /var/spool/mail/root
[root@localhost ~]# rpm -e subscription-manager
You have new mail in /var/spool/mail/root

都删完了就开始安装了。我选择上163镜像源下载软件包。

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

yum相关的包很多,只有yum-3.2.29-81.el6.centos.noarch.rpm是主程序包,我把它下载下来,通过xftp或者xshell自带的ftp工具传到centos6.5系统上。


chmod修改权限之后,检查依赖关系,发现还需要python-urlgrabber和yum-plugin-fastestmirror包,同时需要KEY。

[root@localhost ~]# rpm -ivh --test yum-3.2.29-81.el6.centos.noarch.rpm 
warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
	python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-81.el6.centos.noarch
	yum-plugin-fastestmirror is needed by yum-3.2.29-81.el6.centos.noarch
You have new mail in /var/spool/mail/root

在http://mirrors.163.com/centos/6/os/x86_64 的页面下载RPM-GPG-KEY-CentOS-6文件,传到服务器上,并导入操作系统。

[root@localhost ~]# rpm --import RPM-GPG-KEY-CentOS-6

下载python-urlgrabber和yum-plugin-fastestmirror包。开始安装,结果新下载的包与系统已经安装的包冲突,那就强制卸载掉。

[root@localhost ~]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm 
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
You have new mail in /var/spool/mail/root
[root@localhost ~]# rpm -e python-urlgrabber-3.9.1-9.el6.noarch
error: Failed dependencies:
	urlgrabber is needed by (installed) python-virtinst-0.600.0-18.el6.noarch
	python-urlgrabber is needed by (installed) python-virtinst-0.600.0-18.el6.noarch
[root@localhost ~]# rpm -e python-urlgrabber-3.9.1-9.el6.noarch --nodeps
You have new mail in /var/spool/mail/root

然后重新安装,成功。

[root@localhost ~]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm 
Preparing...                ########################################### [100%]
   1:python-urlgrabber      ########################################### [100%]
安装yum-plugin-fastestmirror包,发现它与yum包互为依赖,同时安装就好了。

[root@localhost ~]# rpm -ivh yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm 
error: Failed dependencies:
	yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.30-40.el6.noarch
[root@localhost ~]# rpm -ivh yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm 
Preparing...                ########################################### [100%]
   1:yum                    ########################################### [ 50%]
   2:yum-plugin-fastestmirro########################################### [100%]

最后试试yum,没问题了。


猜你喜欢

转载自blog.csdn.net/zsx0728/article/details/80674414
今日推荐