By default, CentOS 6 comes with Python 2.6. This is a bit outdated, especially if you take into account, that Python 2.7.11, which is the latest Python 2 release, was released in December 2015. If you are new to Pyhton, you will usually start with Python 3. Currently, Python 3.5.1 is the latest Python 3 release. So, Python 2.6 is REALLY old.
Okay, I could use another distro. Ehm… no. CentOS is the is the open-source version of Red Hat Enterprise Linux (RHEL). It was, and it is, designed to be similar to RHEL. CentOS runs only the most stable versions of packaged software. This greatly reduces the risk of crashes and errors. The downside is… Python 2.6. Or Apache 2.2. Or MySQL 5.1. Switching to CentOS 7 is difficult, because there is no inplace upgrade.
Python 2.7 for CentOS 6
In my case, I needed Python 2.7. Fortunately, this package is offered by the Software Collections ( SCL ) repository. You can install Python 2.7 with two commands.
yum install centos-release-SCL yum install python27 python27-python-devel python27-python-setuptools python27-python-tools python27-python-virtualenv
After the successful installation of the packages, you can find the files located under /opt/rh/python27. Next step is to create a python.conf under /etc/ld.co.conf.d and run ldconfig afterwards.
[[email protected] ~]# echo "/opt/rh/python27/root/usr/lib64" > /etc/ld.so.conf.d/python27.conf [[email protected] ~]# cat /etc/ld.so.conf.d/python27.conf /opt/rh/python27/root/usr/lib64 [[email protected] ~]# ldconfig
Last step is to create a symlink for the Python 2.7 binary.
[[email protected] ~]# ln -s /opt/rh/python27/root/usr/bin/python2.7 /usr/bin/python2.7
If you want to use Let’s Encrypt with CentOS 6, make sure to use Python 2.7.
- Escaping special characters in proxy auth passwords in vCenter - October 8, 2021
- On the road to… nowhere? - July 26, 2021
- Configure VMware Horizon View client device certificate authentication - March 11, 2021