2021-01-09 Install Python 3.9 and many packages on Linux Debian 10

Password

sudo passwd

sudo, git, valgrind, nodejs

apt-get install sudo git valgrind nodejs npm

Firewall

Let’s start with the firewall:

apt-get install ufw
sudo ufw enable
sudo ufw allow ssh
sudo ufw allow 8080/tcp

Another series of packages to install:

apt-get install intel-mkl
apt-get install cmake apt-transport-https clang
apt-get install protobuf-compiler libprotoc-dev
apt-get install chromium-driver
apt-get install dvipng p7zip-full inkscape graphviz unrar

Python

Then Python 3.9. Some package require a different build because they need shared libraries. About –enable-shared, see Relocation R_X86_64_32S against _Py_NotImplementedStruct can not be used when making a shared object; recompile with -fPIC, How to configure python with –enable-shared on Ubuntu 18.04 Option –enable-shared –prefix=/opt/python is needed when to embed python interpreter in a C application, see Embedding the Python interpreter.

sudo apt update && sudo apt upgrade
sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev software-properties-common
wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
tar xzf Python-3.9.1.tgz
cd Python-3.9.1
./configure --enable-optimizations --with-ensurepip=install --enable-shared --prefix=/opt/python
make
make altinstall

If needed, do it again with:

::

./configure –enable-optimizations –with-ensurepip=install –enable-shared make make altinstall

These settings must be added every time python is run or a python module is compiled:

export LD_LIBRARY_PATH=/usr/local/lib/

/etc/environment/

You may add the following two lines in file ``/etc/environment/**:

export LLVM_CONFIG=/usr/bin/llvm-config
export LD_LIBRARY_PATH=/usr/local/lib/

llvmlite

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 10
ls /usr/bin/llvm*
sudo ln -s /usr/bin/llvm-config-8 /usr/bin/llvm-config
python3.9 -m pip install llvmlite

These settings must be also added:

export LLVM_CONFIG=/usr/bin/llvm-config

GEOS

Useful to draw maps.

apt-get install libgeos-dev libproj-dev proj-data graphviz libblas-dev liblapack-dev
python3.9 -m pip install shapely pyproj shapely cartopy

Latex

apt-get install texlive texlive-latex-extra texlive-xetex

pandoc

apt-get install pandoc

Jenkins

Then Jenkins:

sudo apt update
sudo apt install default-jdk
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins
sudo systemctl enable --now jenkins

To retrieve the password:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Website

See Installation of nginx <blog-nginx-install>.

FTP server

See Install FTP server on debian <blog-ftp-vsftpd>.

profile

Edit file:

~/.profile

pypiserver

nohup python3.9 -m pypiserver --port=8067 --root=/var/lib/jenkins/workspace/local_pypi/local_pypi_server/ > pypi.log &

keyring

Something is missing here. Maybe for the next installation.

apt-get install libdbus-glib-1-2 libdbus-glib-1-dev dbus-tests dbus-launch gnome-keyring
python3.9 -m pip install dbus-python keyring keyrings.cryptfile

export $(dbus-launch)

pycurl

apt-get install libcurl4-openssl-dev libssl-dev
python3.9 -m pip install pycurl