Updating Python on RHEL/CentOS
CEO & Founder of Server Density.
Published on the 19th January, 2010.
All our production servers run Red Hat Enterprise Linux (RHEL) 5 with the system supplied packages for the majority of applications we run, with the exception of PHP which we have a custom compiled version. In the realms of gaining maximum performance then custom compilation of the likes of MySQL and Apache is beneficial but the advantage of using vendor supplied packages is that they are automatically maintained and updated. They are also included within the support SLA we have with Rackspace.
The problem is that the vendor will rarely update to new feature point releases and instead keep things up to date in terms of bug and security fixes only. This means we are stuck with Python 2.4 on RHEL, and we can’t upgrade it as many components will likely break due to specific dependance on Python 2.4.
We have recently deployed some new code that requires Python 2.5 or above and talking with Rackspace, we were able to install a separate Python 2.6 installation through their IUS Community project.
The IUS Community Project is aimed at providing up to date and regularly maintained RPM packages for the latest upstream versions of PHP, Python, MySQL and other common software specifically for Redhat Enterprise Linux. IUS can be thought of as, “A better way to upgrade RHEL” when you really need to.
This provides us with a yum repository we can access to install the latest versions of core packages such as Python, MySQL, Apache (and PHP if we were using it) and although they are not supported by Rackspace, the project is maintained and sponsored by them. Indeed, our Rackspace support team ran the installation of the new version of Python for us.
root@pan ~: wget http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1-2.ius.el5.noarch.rpm
root@pan ~: rpm -Uvh ius-release-1-2.ius.el5.noarch.rpm
root@pan ~: yum install python26
This installs Python into a separate directory so as not to overwrite the default system installed version:
root@pan ~: rpm -qil python26 | grep /usr/bin
And they have repos available for:
RHEL/CentOS 4 i386
RHEL/CentOS 4 x86_64
RHEL/CentOS 4 Source RPMS
RHEL/CentOS 5 i386
RHEL/CentOS 5 x86_64
RHEL/CentOS 5 Source RPMS