原因:

    最近业务要用salt管理,全部手工安装salt,本来很简单的事,但由于业务强烈依赖perl与OS所以不能升级系统软件,但之前有一部分老的平台升级了python,安装多个在版本的python,yum本身的python写的,当安装salt-minion提示python版本冲突,那么只能将高版本卸载了(python-2.6.6-64),卸载之后yum无法使用了,也不知道是怎么想的执行了rpm -e --nodeps yum,之后我说傻了,这怎么搞啊,去pkgs.org下载新版本的yum.rpm包吧,结果各种依赖,还是不能用,将其它服务器的python移过来还是不能用(己经修改了/usr/bin/yum的解析器)。

解决办法:

wget http://yum.baseurl.org/download/3.2/yum-3.2.28.tar.gz

下载比较低版本的yum,我怕还不能使用

创建/etc/yum.conf文件(如果没有的话)

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=19&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

解压文件 

tar xf yum-3.2.28.tar.gz
cd yum-3.2.28
#使用全路径的python,否则有很多内置相关的模块没有找到
/usr/bin/python2.6 yummain.py install yum

当yum安装完成后,就可以使用

yum clean all 
[root@mx74 python_rpm]# yum repolist
Loaded plugins: fastestmirror, security
Determining fastest mirrors
 * base: mirrors.btte.net
 * extras: mirrors.sina.cn
 * updates: mirrors.btte.net
base                                                                                          | 3.7 kB     00:00     
base/primary_db                                                                               | 4.6 MB     00:00     
epel                                                                                          | 4.3 kB     00:00     
epel/primary_db                                                                               | 5.7 MB     02:12     
extras                                                                                        | 3.4 kB     00:00     
extras/primary_db                                                                             |  27 kB     00:00     
updates                                                                                       | 3.4 kB     00:00     
updates/primary_db                                                                            | 1.3 MB     00:00     
repo id                             repo name                                                                  status
base                                CentOS-6 - Base                                                             6,575
epel                                Extra Packages for Enterprise Linux 6 - x86_64                             11,775
extras                              CentOS-6 - Extras                                                              35
updates                             CentOS-6 - Updates                                                            260
repolist: 18,645



总结:

   卸载包的时候一定要用rpm,不要用yum!!!



ps:之前总觉得对系统有一定的了解,经历此事件,原来自己就是渣渣,以后要加强总结与学习!!!