Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Centos 6 based VPS with an ssh connection. Recently wanting to install python 2.7.2, I bravely ran:

yum remove python

wich apparently removed yum itself being written or depends on python.

Now I don't know what to do and to make matters worse, I am a complete Linux newbie (command line or otherwise).

Running "rpm -iv http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm"

gives:

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

and its a x86_64 server no question about it as "uname -a" gives:

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

One more thing:

"ls /usr/bin/pyth* -la" gives:

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
share|improve this question
add comment

1 Answer

up vote 16 down vote accepted

Pick a mirror from the list of CentOS 6 mirrors and install the packages you need using rpm. You would need to deal with dependencies. Lucky for you, I have a pretty bare VM with CentOS 6 x86_64 installed.

I snapshot the VM, ran yum remove python and had some fun getting through some circular dependencies. Final result:

# --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

Replace the mirror which whatever one you want. Also, make sure the architecture matches. That should do the trick though!

Oh one more thing: If I were you, I'd run a yum upgrade right after you're done installing the RPMs.

share|improve this answer
    
That would be great –  user94626 Dec 4 '11 at 20:14
    
After running the first rpm commands, python is being reported as unrecognized command: -bash: python: command not found –  user94626 Dec 4 '11 at 20:37
    
Python will not work till the 2nd RPM file is installed. Hate to be one of "those" but try to understand the command before pasting it. Perhaps a man rpm is in order. –  Beaming Mel-Bin Dec 4 '11 at 20:40
    
I ran all the first set of 8 commands, that is. The last two are for yum and what you said is obvious. Although running them again gives an 'already installed' message. Perhaps my python directory structure is messed-up or something. And by the way, after installing yum anyway, running yum is giving: "-bash: /usr/bin/yum: /usr/bin/python: bad interpreter: No such file or directory" –  user94626 Dec 4 '11 at 20:47
    
Run rpm -iv http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_6‌​4.rpm and paste the output as an edit to your question. Also, are you sure you are running x86_64? Run uname -a and paste the output of that in the edit as well please. –  Beaming Mel-Bin Dec 4 '11 at 20:54
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.