Skip to main content

IT - Compile and install Python 3.6.9 on Debian 7/8

Here is the way to install Python 3.6.x on older Debian version (< 9)

# Do cmds as root
sudo su
cd ~
# Download python sources and extract them
wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
tar xvf Python-3.6.9.tgz
# Enter directory then config make & install (altinstall is recommended, see https://docs.python.org/3/using/unix.html#building-python)
cd Python-3.6.9
./configure --enable-optimizations --enable-shared --with-ensurepip=install
make -j8
# On debian 7 replace above make command by the following
# apt-get install libgdbm-dev
# make -j `nproc`
make altinstall
# Debian fix : Copy lib files into sys lib directory
cp libpython3.6m.so.1.0 /usr/lib/

On Debian/Ubuntu, some packages need to be installed to avoid some known problems

apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev

It takes approximatively 20 minutes to build on AWS t2.small instance, so be patient !

This step is a prerequisite to install last generation ACME client like certbot. Please check this link on how to install latest certbot version with Python3.6 / venv / pip.

Remember :
- Debian 7 (stretch) is EOL since 2018 may 31th
- Debian 8 (jessie) is EOL since 2020 june 30th
In both case, it's better to setup a new VPS with an up to date Operating System and migrate customer content into it.