记一次修复yum被破坏

现象

# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

只能重装yum了

找台正常的机器

mkdir yum_rpms && cd yum_rpms
repoquery -R --resolve --recursive yum-3.2.29|xargs -I{} yumdownloader {} --destdir=.

# 卸载旧yum包
rpm -e --nodeps yum-3.2.29-81.el6.centos.noarch yum-plugin-fastestmirror-1.1.30-40.el6.noarch yum-metadata-parser-1.1.2-16.el6.x86_64

21862  2019-12-19_10:56:04 rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
21863  2019-12-19_10:56:10 rpm -ivh python-urlgrabber
21864  2019-12-19_10:56:16 rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
21865  2019-12-19_10:56:23 rpm -ivh python-pycurl-7.19.0-9.el6.x86_64.rpm
21866  2019-12-19_10:56:25 rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
21867  2019-12-19_10:56:33 rpm -ivh yum-*
21868  2019-12-19_10:56:40 rpm -ivh rpm-python-4.8.0-55.el6.x86_64.rpm
21869  2019-12-19_10:56:46 rpm -ivh yum-*
21870  2019-12-19_10:56:49 yum info

并不是rpm -ivh * 就能解决的, 有依赖关系,缺哪个装哪个

posted @ 2019-12-19 11:24  txwsqk  阅读(590)  评论(0编辑  收藏  举报