Let’s Encrypt will soon no longer support Python 2.6 due to its security update and the depreciate error prompted when running letsencrypt-auto script.
Here is how to install Python 2.7 in CentOS 6 (can be done on CentOS 7 too) and enable Let’s Encrypt to use Python 2.7 environment.
Install Python 2.7 in Centos
Grab latest Python 2.7 from https://www.python.org/ftp/python, when we write this tutorial, it’s version 2.7.9, it could be different version when you found this tutorial.
We will do a wget for 2.7.9 python installation files.
# wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
After file being downloaded let’s un-xz and un-tar it.
# xz -d Python-2.7.9.tar.xz # tar -xvf Python-2.7.9.tar
Change into the directory and start compile & install Python 2.7 in CentOS 6/7 box
# cd Python-2.7.9 # ./configure --prefix=/usr/local # make # make altinstall
Python 2.7 binary will be installed into /usr/local/bin
# cd /usr/local/bin # ls python2* python2.7 python2.7-config
Basically the installation of Python 2.7 is done. Next will need to re-configure Let’s Encrypt python environment.
Re-Configure Let’s Encrypt Environment for Python 2.7
The environment files is installed in /root/.local/share/letsencrypt
We will rename the files in /root/.local into other name
# mv /root/.local /root/.oldlocal
Next, go to Let’s Encrypt folder to re-run the install by invoking this command
# cd /opt/letsencrypt # ./letsencrypt-auto renew Bootstrapping dependencies for RedHat-based OSes... yum is /usr/bin/yum Loaded plugins: fastestmirror, replace Setting up Install Process Loading mirror speeds from cached hostfile * base: kodeterbuka.beritagar.id * epel: epel.mirror.angkasa.id * extras: centos.mirror.angkasa.id * rpmforge: mirror.smartmedia.net.id * updates: centos.mirror.angkasa.id * webtatic: us-east.repo.webtatic.com Package gcc-4.4.7-17.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-1.0.1e-48.el6_8.3.x86_64 already installed and latest version Package openssl-devel-1.0.1e-48.el6_8.3.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-51.el6.centos.noarch already installed and latest version Package ca-certificates-2015.2.6-65.0.1.el6_7.noarch already installed and latest version Package python-2.6.6-66.el6_8.x86_64 already installed and latest version Package python-devel-2.6.6-66.el6_8.x86_64 already installed and latest version Package python-virtualenv-1.10.1-1.el6.noarch already installed and latest version Package python-tools-2.6.6-66.el6_8.x86_64 already installed and latest version Package python-pip-7.1.0-1.el6.noarch already installed and latest version Package 1:mod_ssl-2.2.15-54.el6.centos.x86_64 already installed and latest version Nothing to do Creating virtual environment... Installing Python packages...
Ignore the error, if you do not have any cert created before. To confirm it’s now created Python 2.7 environment, go to the lib folder to take a look.
# cd /root/.local/share/letsencrypt/lib/ # ls python2.7
Another question is can you install Python version > 2.7 for Let’s Encrypt? We think it cannot be done, it’s became letsencrypt-auto only search for python2 or python2.7 binary in your environment (/bin /usr/local/bin). As long as you didn’t see the depreciate error like below, Let’s Encrypt should work fine 😉
./letsencrypt-auto renew /root/.local/share/letsencrypt/lib/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6 DeprecationWarning