Python 2.7 is not available in the Red Hat repository on RHEL 5, and the Python installation activities are different in RHEL 5. We can install it from the Python source code.
Step 1: We need to download the Python source code from the www.python.org
# cd /usr/src # wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz --no-check-certificate
Note: if there is no internet connectivity in the target system, You can download it from your PC/Laptop and copy it to your target system.
# tar -xzvf Python-2.7.6.tgz # rm -rf Python-2.7.6.tgz # cd Python-2.7.6 # ./configure --prefix=/opt/python2.7 --enable-shared # make # make altinstall
Step 2: Re-link the python program and the libraries with the python2.7, as below:
# mv /usr/bin/python /usr/bin/python_org # ln -s /opt/python2.7/bin/python2.7 /usr/bin/python # ln -s /opt/python2.7/lib/libpython2.7.so.1.0 /usr/lib64/ # ln -s /opt/python2.7/lib/python2.7 /usr/lib64/
Step 3: Verify the current python version.
# python -V Python 2.7.6
There are lots of applications still running on the RHEL 5 Operating System, and you might need to install python 2.7 on that for certain scenarios. hope this document will help you.