Recently we installed a development server running 64-Bit (x86_64) CentOS Linux. One of the things we needed to install was Python version 2.6 without overwriting the default Python version 2.4 on the server. The reason for not wanting to overwrite the default Python version is because other packages such as the Yum Package Manager depend on Python version 2.4. Anyhow in the past I have used the CHL repository for the Python version 2.6 packages because they are compiled to run as python26 or python2.6 and using the python command still launches python 2.4. Anyhow after installing the CHL yum repository as noted here we had issues installing python version 2.6 which I describe below along with how to resolve the issue.
Error Installing Python Version 2.6 On 64-Bit CentOS Linux:
After installing the CHL yum repository as noted in this article on a new 64-Bit CentOS Linux server we had issues installing the typical Python packages we do on other servers. Finally I remembered that this server was 64-Bit CentOS and typically we use 32-Bit CentOS so I started troubleshooting keeping that in mind. Eventually I located the issue which is that the CHL repository doesn’t have all of the i386 packages available as x86_64 packages. This causes an issue because in a typical yum .repo configuration file you specify a variable at the end of the baseurl variable. This variable which is called $basearch actually looks to see if your server is 32-Bit or 64-Bit. Since the CHL repo doesn’t have a 64-Bit package repository it errors out and doesn’t display anything. Below I list the default chl.repo file that is installed when you install the repository and then I list a modified version that will work with 64-Bit CentOS Linux.
Default chl.repo Yum Configuration File:
- [chl]
- name=CHL Packages for Enterprise Linux 5 - $basearch
- baseurl=http://yum.chrislea.com/centos/5/$basearch
- #mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
- failovermethod=priority
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
- [chl-source]
- name=CHL Packages for Enterprise Linux 5 - $basearch - Source
- baseurl=http://yum.chrislea.com/centos/5/SRPMS
- #mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
- failovermethod=priority
- enabled=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
- gpgcheck=1
Notice the $basesearch variable at the end of the baseurl variable. This needs to be modified from $basearch to i386 to work with 64-Bit CentOS Linux as shown below in the updated configuration file.
Modified chl.repo Configuration File To Work With 64-Bit CentOS Linux:
- [chl]
- name=CHL Packages for Enterprise Linux 5 - $basearch
- baseurl=http://yum.chrislea.com/centos/5/i386
- #mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
- failovermethod=priority
- enabled=1
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
- [chl-source]
- name=CHL Packages for Enterprise Linux 5 - $basearch - Source
- baseurl=http://yum.chrislea.com/centos/5/SRPMS
- #mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
- failovermethod=priority
- enabled=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
- gpgcheck=1
Please keep in mind that the above configuration will list all of the available packages but will only install the 32-bit version of Python version 2.6. I will be writing another article soon regarding installing the 64-bit Python version 2.6 on CentOS 5.X Linux.