Redhat / CentOS 6.x users need python 2.7

Seeing as a few Redhat and CentOS 6.x users have been caught by Letsencrypt’s client requirements for Python 2.7, I decided to post a dedicated thread for installing Python 2.7 beside RHEL/CentOS 6.x default Python 2.6. CentOS/RHEL 7 users are fine as Python 2.7 is default unlike CentOS/RHEL 6.x default Python 2.6.

CentOS 6.x runs python 2.6.6 but letsencrypt client requires python 2.7 https://github.com/letsencrypt/letsencrypt/issues/1106

Update: Letsencrypt client re-added Python 2.6 support. However Centos 6.x at least doesn’t have python-virtualenv package, so requires EPEL yum repo for it https://github.com/letsencrypt/letsencrypt/pull/1241

For centos 6, you can install python 2.7 besides python 2.6 via IUS Community yum repo https://ius.io/GettingStarted/ and then install python 2.7

yum -y install python27 python27-devel python27-pip python27-setuptools python27-virtualenv --enablerepo=ius

then do what i do and replace python2 with python 2.7 in letsencrypt-auto script

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
sed -i "s|--python python2|--python python2.7|" letsencrypt-auto
./letsencrypt-auto --verbose

Hope that helps folks :slight_smile:

threads of reference

4 Likes

Might also be possible w/o the IUS repo :

yum install centos-release-SCL
yum install python27 python27-python-devel python27-python-setuptools python27-python-tools python27-python-virtualenv

https://wiki.centos.org/AdditionalResources/Repositories/SCL

*did not try, not part of beta, yet! :wink:

1 Like

cheers @svennd more than one way to install Python 2.7 :slight_smile:

heads up folks on CentOS/RHEL 6 might want to read or provide their input on https://github.com/letsencrypt/letsencrypt/pull/1172

Also EPEL yum repo seems to be required for CentOS 6 https://github.com/letsencrypt/letsencrypt/issues/1204#issuecomment-152664407 for python-virtualenv package not that it matters as that is python 2.6 based not python 2.7 based

Also, I had to remove old letsencrypt files to be able to use new python version:

rm -Rf /root/.local/share/letsencrypt

I also run this command:

alias python=python2.7

To make sure everything will be run under python 2.7 :smile:

2 Likes

I tried this on Amazon Linux, which is a RHEL/Centos6 distro. I didn't need to use any external repos to install Python 2.7 and python -V returns 2.7.10… but when I try to run the letsencrypt install, I get this…

Sorry, I don't know how to bootstrap Let's Encrypt on your operating system!

You will need to bootstrap, configure virtualenv, and run a pip install manually
Please see Contributing — letsencrypt latest documentation
for more info
WARNING: Python 2.6 support is very experimental at present...
if you would like to work on improving it, please ensure you have backups
and then run this script again with the --debug flag!

:frowning:

does your system have python-virtualenv yum package ? centos 6.x at least doesn’t so requires EPEL yum repo for it https://github.com/letsencrypt/letsencrypt/pull/1241

I also have CentOS 6. (There is a huge installed base of CentOS6, I have a feeling this is goign to be a common problem)

I have installed python 2.7 and set it up as the default python

‘# alias python=/usr/local/bin/python2.7
’# python --version
Python 2.7.6

When I run the following:
./letsencrypt-auto --help

I get the following. Can someone explain what’s going on here?

Bootstrapping dependencies for RedHat-based OSes…
yum is /usr/bin/yum
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Package python-2.6.6-64.el6.x86_64 already installed and latest version
Package python-devel-2.6.6-64.el6.x86_64 already installed and latest version
No package python-virtualenv available.
Nothing to do
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Package git-1.7.1-3.el6_4.1.x86_64 already installed and latest version
Package gcc-4.4.7-16.el6.x86_64 already installed and latest version
Package dialog-1.1-9.20080819.1.el6.x86_64 already installed and latest version
Package augeas-libs-1.0.0-10.el6.x86_64 already installed and latest version
Package openssl-devel-1.0.1e-42.el6.x86_64 already installed and latest version
Package libffi-devel-3.0.5-3.2.el6.x86_64 already installed and latest version
Package redhat-rpm-config-9.0.3-44.el6.centos.noarch already installed and latest version
Package ca-certificates-2015.2.4-65.0.1.el6_6.noarch already installed and latest version
Nothing to do
WARNING: Python 2.6 support is very experimental at present…
if you would like to work on improving it, please ensure you have backups
and then run this script again with the --debug flag!

i don’t use alias method, i just use the method outlined in 1st post with IUS Community repo and sed replacement

Hello @pfreet,
Here's what I did to get it working on Amazon's Linux AMI:

:sunglasses: Good luck!

1 Like

I solved this problem using Software Collections on CentOS 6. It is an elegant solution similar to what some others have posted here.

https://thelastcicada.com/solving-the-python-2-6-issue-for-letencrypt-on-centos-6

Basic concept is

  1. Install Software Collections yum install centos-release-SCL

  2. Install Python 2.7 yum install python27

  3. Run LetsEncrypt via Software Collections scl enable python27 "/root/letsencrypt/letsencrypt-auto certonly --agree-tos --webroot --webroot-path /var/www/html/mywebsite.com -d mywebsite.com"

2 Likes

@TheLastCicada Brilliant. Thank you.

No need to run alias here, but removing the /root/.local/share/letsencrypt folder was essential Cheers