Archives / Snippets / Projets

TODO

Digital Ocean - Droplet

Alwaysdata - Redirection

Sources:

* https://github.com/jupyterhub/jupyterhub/wiki/Installation-of-Jupyterhub-on-remote-server

* http://jupyterhub.readthedocs.io/en/latest/getting-started/config-basics.html

On a new system, you may need :

* https://www.thomas-krenn.com/en/wiki/Configure_Locales_in_Ubuntu

locale-gen fr_FR.UTF-8
update-locale LANG=fr_FR.UTF-8 LC_MESSAGES=POSIX
# fresh login needed
apt update
apt upgrade

Tools to install jupyterlab / jupyterhub

apt install npm nodejs-legacy
npm install -g configurable-http-proxy

apt install python3-pip
pip3 install --upgrade pip

Jupyterlab / Jupyterhub install

pip3 install jupyterhub pip3 install --upgrade notebook pip3 install jupyterlab pip3 install ipywidgets

pip3 install dockerspawner

Install Python scientific stack

pip3 install numpy scipy matplotlib pandas sympy nose

apt install graphviz pip3 install graphviz

Add new users (for PAM authentificator)

adduser <username>
sudo adduser <username> sudo

SSH Login without password

Jupyterhub as a service

https://github.com/jupyterhub/jupyterhub/wiki/Run-jupyterhub-as-a-system-service

Jupyterhub Config

touch jupyterhub_config.py
# puis vi, emacs, nano, ou autre hein...

Ajouter/Décommenter :

c.Spawner.default_url = '/lab'

TODO

* Authentificator :

* Google... ou pas. L'objectif est d'avoir les utilisateurs que je souhaite !

* Moins verbose... (?)

* Copier des fichiers par défaut... : ou default_dir

* Admin pour accéder au contenu des autres

SSL / SAN

SSL : sur une adresse IP, ce n'est pas vraiment simple...

* Il faudrait un nom de domaine transparent... ce n'est pas le cas

openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout my.key -out my.cert

""" Generating a 2048 bit RSA private key ..................+++ ......................................................+++ writing new private key to 'my.key'

You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank.

Country Name (2 letter code) [AU]:FR State or Province Name (full name) [Some-State]: Locality Name (eg, city) []:Lyon Organization Name (eg, company) [Internet Widgits Pty Ltd]:Laurent Jouhet-Reverdy Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []:code.ljouhet.net Email Address []:ljouhet@gmail.com """

Let's Encrypt

""" J'ai été obligé de tricher :

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
./certbot-auto

On a alors :

root@jupyter:~# ./certbot-auto certonly --manual -d ljouhet.net -d code.ljouhet.net
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for ljouhet.net
http-01 challenge for code.ljouhet.net

-------------------------------------------------------------------------------
NOTE: The IP of this machine will be publicly logged as having requested this
certificate. If you're running certbot in manual mode on a machine that is not
your server, please ensure you're okay with that.

Are you OK with your IP being logged?
-------------------------------------------------------------------------------
(Y)es/(N)o: Y

-------------------------------------------------------------------------------
Create a file containing just this data:

6ZJDw0OM7IjE8FaVvAFHGkApYANH5AloRMEF9-YYHEw.ylhe4wJcc_8aBd5SB-3B2YYEIm04F1vYmVDK47iFEF8

And make it available on your web server at this URL:

http://ljouhet.net/.well-known/acme-challenge/6ZJDw0OM7IjE8FaVvAFHGkApYANH5AloRMEF9-YYHEw

-------------------------------------------------------------------------------
Press Enter to Continue

Erreurs

  • Proxy déjà démarré
ps aux | grep proxy
pkill ...
# (ou)
sudo pkill node

En plus

  • Scientific stack, graphviz, nbtutor

Extensions

OCaml

  • Copier les fichiers dans /usr/local/share/jupyter/kernels/ocaml/
  • sudo apt-get install ocaml opam rlwrap m4