Posted on

Installing Python 2.7 on Oracle Linux 6.8

I recently found a need to use Python 2.7 on Oracle Linux 6.8. Some of this has to do with the underlying SSL libraries.  You will need a licensed version of Oracle Linux in order to complete this process.

This is how I did it.

1.) Install the Software Collections Utilities


skipper@ssminnow~$ sudo yum install scl-utils

2.) Download the Oracle Software Repo


skipper@ssminnow~$ sudo wget -O /etc/yum.repos.d/public-yum-ol6.repo http://yum.oracle.com/public-yum-ol6.repo

3.) Edit the repo and enable the [ol6_software_collections] repository by changing enabled=0 to enabled=1 under the ol6_software_collections stanza


skipper@ssminnow~$ sudo vi /etc/yum.repos.d/public-yum-ol6.repo
[ol6_software_collections]
name=Software Collection Library release 2.2 packages for Oracle Linux 6 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL6/SoftwareCollections/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
<strong>enabled=1   # change this to 1 from 0</strong>

4.) Install Python Version 2.7


skipper@ssminnow~$ sudo yum install python27

5.) Enable the SCL


skipper@ssminnow~$  scl enable python2.7 bash

skipper@ssminnow~$ python -V

6.) Make Python 2.7 persistent


skipper@ssminnow~$ sudo vi /etc/profile.d/enable_python27.sh

#!/bin/bash

source scl_source enable python27

7.) Logout and login again


skipper@ssminnow~$ exit

 

That should be all you need to make Python 2.7 persist inside of Oracle Linux. Utilities such as yum will still use the old Python 2.6 interpreter (as it needs it)