如何撤消“yum remove python”

我有一个与ssh连接的基于Centos 6的VPS。 最近想安装python 2.7.2,我勇敢地跑了:

yum remove python 

这显然删除了百胜自己正在写或取决于python。

现在我不知道该怎么做,更糟糕的是,我是一个完整的Linux新手(命令行或其他)。

运行rpm -iv http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm给出:

 Retrieving http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm Preparing packages for installation... package python-2.6.5-3.el6.x86_64 is already installed 

和它的x86_64服务器毫无疑问,因为“uname -a”给出:

 Linux xxxxxx 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linux 

还有一件事: ls /usr/bin/pyth* -la给出:

 lrwxrwxrwx 1 root root 6 Dec 4 20:31 python2 -> python -rwxr-xr-x 2 root root 4864 Nov 12 2010 python2.6 -rwxr-xr-x 2 root root 4864 Nov 12 2010 python;4edbd894 

从CentOS 6镜像列表中select镜像,然后使用rpm安装所需的软件包。 你将需要处理依赖关系。 幸运的是,我安装了CentOS 6 x86_64的虚拟机。

我快照虚拟机,运行yum remove python ,并通过一些循环依赖关系有一些乐趣。 最后结果:

 # --nodeps: because of circular dependency between python and python-libs rpm -i --nodeps http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-libs-2.6.5-3.el6.x86_64.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/pygpgme-0.1-18.20090824bzr68.el6.x86_64.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-pycurl-7.19.0-5.el6.x86_64.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-urlgrabber-3.9.1-7.el6.noarch.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/rpm-python-4.8.0-12.el6.x86_64.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm # --nodeps: because of circular dependency between yum and yum-plugin-fastestmirror rpm -i --nodeps http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm 

更换任何你想要的镜子。 另外,确保架构匹配。 这应该做的伎俩,虽然!

还有一件事:如果我是你,在完成安装RPM之后,我会立即yum upgrade