Provision jupyter Lab

2020-09-20

Walkthrough on how to setup a jupyter instance for lectures

Motivation

For my lectures in operating systems, I'm regularily using jupyterlab for interactively doing things on the command line by simultaneously recording of the output. I've tested the setup guid on my notebook with the following specifications

Install required packages

Dotnet interactive

These packages are required to support F#, C# and PowerShell for more information see dotnet/interactive (github)[1]. Detailed installation instructions for the SDK can be found under this link[2]

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update; \
  sudo apt-get install -y apt-transport-https && \
  sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-3.1

Additionally for documentatation via LaTeX or Pandoc

sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-generic-recommended pandoc

Development via gcc

sudo apt-get install build-essential

Basic Installation of Anaconda

Answer during installation with yes two times

wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
bash ./Anaconda3-2020.07-Linux-x86_64.sh
source ~/.bashrc

Configuration of Jupyter as Notebook Server

For more details see

https://jupyter-notebook.readthedocs.io/en/stable/public_server.html
jupyter notebook --generate-config

Following entries need to be modified (not secure!) /home/dak/.jupyter/jupyter_notebook_config.py

# Set ip to '*' to bind on all interfaces (ips) for the public server
c.NotebookApp.ip = '*'
c.NotebookApp.token = ''
c.NotebookApp.open_browser = False

# It is a good idea to set a known, fixed port for server access
c.NotebookApp.port = 9999

Start the server by invoking

jupyter-lab

Install Additional kernels

In case we need a kernel for bash, following these steps:

conda install -c conda-forge bash_kernel 

Similar, if we need to support dotnet interactive.

dotnet tool install -g --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json" Microsoft.dotnet-interactive
dotnet interactive jupyter install

Finally, if we need support for cpp. For more information see

https://github.com/root-project/cling
wget https://root.cern.ch/download/cling/cling_2020-09-08_ROOT-ubuntu2004.tar.bz2
tar xfj cling_2020-09-08_ROOT-ubuntu2004.tar.bz2
echo 'export PATH=/home/dak/cling_2020-09-08_ROOT-ubuntu2004/bin:$PATH' >> ~/.bashrc

Detailed description of that step can be found under

https://github.com/root-project/cling/tree/master/tools/Jupyter
cd /home/dak/cling_2020-09-08_ROOT-ubuntu2004/share/cling/Jupyter/kernel
pip install -e .
jupyter-kernelspec install --user cling-cpp11

Links

[1]: dotnet interactive
[2]: linux ubuntu