Installing certbot on systems running outdated versions of Python

Hi there,

first things first: Thank you so much for conceiving and maintaining Let’s Encrypt and certbot . We would not be able to live without both of these fine tools these days.

Introduction

Coming from PIP error with certbot-auto, we figure a growing amount of users are faced with problems revolving not being able to install or run certbot on outdated systems like Debian 7.11 not providing a reasonable modern version of Python. We learned that certbot currently has a minimum requirement of Python 3.4.2.

We found a solution which is both solid and sustainable by using pyenv, which will give you arbitrary Python environments like RVM for Ruby or nodeenv for Node.js and is similar delightful to use. Installing software this way makes it completely decoupled from the installation of your system distribution which we consider a good thing for these kinds of use-cases.

Install pyenv

By using pyenv, we will install Python 3.4.2 as a minimum requirement of certbot on the system in a non-invasive way and then certbot itself along with some of its plugins.

Detailed installation instructions for pyenv.
# Counter "/tmp" being mounted noexec
export TMPDIR=/var/tmp

# Install pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

This gives further instructions about how to actually activate the software.

# Load pyenv automatically by adding
# the following to ~/.bashrc:

export PATH="/root/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Install Python 3.4.2

pyenv install 3.4.2

Install certbot

# Run the following commands with the designated Python version
export PYENV_VERSION=3.4.2

# Upgrade setuptools
pip install setuptools --upgrade

# Install certbot
pip install certbot requests requests-toolbelt pbr

# Optionally, install plugins
pip install certbot-apache

Activate certbot system-wide

Without further ado, you might want to provide the certbot command of this installation to the whole system after removing any other - probably defunct - versions of certbot beforehand.

ln -s /root/.pyenv/versions/3.4.2/bin/certbot /usr/local/bin/certbot

Voilà

You are now running a contemporary version of certbot, even on an older system than certbot would originally be possible to run on.

$ certbot --version
certbot 0.33.1

We hope this might help the one or another wrestling with these kinds of problems.

With kind regards,
Andreas.


P.S.: This guideline should definitively work with more recent versions of Python either. However, we just wanted to demonstrate here that certbot currently requires Python 3.4 at least and that this actually does work.

P.P.S.: @auspex1: Thank you so much for your suggestions on this through PIP error with certbot-auto.

3 Likes

Note: Necessary to stop using certbot-auto after these changes, as it will still load the old environment.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.