apt-get update
apt-get install -yq --no-install-recommends \
wget \
bzip2 \
ca-certificates \
sudo \
locales \
nano \
fonts-liberation \
python3-pip \
python3-setuptools \
build-essential \
curl \
gcc g++ make \
libzmq3-dev \
nodejs \
luarocks \
texlive-xetex \
texlive-fonts-recommended \
texlive-generic-recommended \
pandoc
pip3 --version
pip3 install --upgrade pip
pip3 install setuptools
pip3 install wheel
pip3 install jupyterlab
pip3 install ilua
pip3 install jupyterlab_latex
pip3 install nbresuse
pip3 install --upgrade jupyterlab-git
pip3 install jupyterlab-commenting-service
pip3 install bash_kernel
pip3 install --pre jupyterlab-git==0.20.0rc0
python3 -m bash_kernel.install
jupyter serverextension enable --sys-prefix jupyterlab_latex
jupyter labextension install @jupyterlab/latex
jupyter labextension install @jupyterlab/google-drive
jupyter labextension install @jupyterlab/github
jupyter labextension install jupyterlab-mp4
jupyter serverextension enable --py nbresuse
jupyter labextension install @jupyterlab/statusbar
jupyter lab build
jupyter labextension install @jupyterlab/commenting-extension
npm config set prefix $HOME
npm config set python /usr/bin/python3.7
npm install -g ijavascript --unsafe-perm
/root/bin/ijsinstall --install=global --spec-path=full
npm install -g jp-coffeescript --unsafe-perm
/root/bin/jp-coffee-install --install=global --spec-path=full
npm install -g itypescript --unsafe-perm
/root/bin/its --install=global --spec-path=full
jupyter labextension update --all
-
-
Save arvati/efbb7275ee8db131f3c79bf17c080f35 to your computer and use it in GitHub Desktop.
| nano /etc/config/fstab | |
| config mount 'lxc' | |
| option target '/srv/lxc' | |
| option uuid '68706ead-a626-4209-b3d0-1187b835f803' | |
| option fstype 'btrfs' | |
| option btrfs_raid '1' | |
| option options 'subvol=/containers,noatime,nodiratime,noacl,nossd' | |
| # option options 'subvol=/containers,noatime,nodiratime,noacl,degraded,nossd,device=/dev/sda,device=/dev/sdb,device=/dev/sdc,device=/dev/sdd' | |
| option enabled '1' | |
| # debootstrap debian | |
| LXC_CACHE_PATH=/srv/lxc/cache lxc-create --bdev btrfs --name jupyter -t debian -- -r buster -a amd64 | |
| # Patches | |
| chroot /srv/lxc/jupyter/rootfs bash | |
| apt-get update --allow-releaseinfo-change | |
| apt-get remove --purge --auto-remove systemd | |
| apt-get install sysvinit-core sysvinit-utils | |
| apt-get purge systemd* | |
| echo -e 'Package: *systemd*\nPin: release *\nPin-Priority: -1\n' > /etc/apt/preferences.d/systemd | |
| echo -e 'Package: libsystemd0\nPin: version *\nPin-Priority: 500\n' >> /etc/apt/preferences.d/nosystemd | |
| rm /etc/systemd/system/default.target | |
| ln -s /dev/null /etc/systemd/system/udev.service | |
| ln -s /dev/null /etc/systemd/system/systemd-udevd.service | |
| ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target | |
| exit | |
| # External World folder | |
| mkdir -p /mnt/data/media/Server/jupyter | |
| # lxc config file | |
| nano /srv/lxc/jupyter/config | |
| lxc.net.0.hwaddr = 00:16:3e:b1:75:ba | |
| lxc.net.0.type = veth | |
| lxc.net.0.link = br-lan | |
| lxc.net.0.flags = up | |
| lxc.rootfs.path = btrfs:/srv/lxc/jupyter/rootfs | |
| lxc.mount.entry=/mnt/data/media/Server/jupyter srv/ none bind 0 0 | |
| # Common configuration | |
| lxc.include = /usr/share/lxc/config/debian.common.conf | |
| # Container specific configuration | |
| lxc.tty.max = 4 | |
| lxc.uts.name = jupyter | |
| lxc.arch = amd64 | |
| lxc.pty.max = 1024 | |
| # How to start and stop container | |
| lxc-start --name jupyter | |
| lxc-attach --name jupyter | |
| passwd | |
| exit | |
| lxc-console --name jupyter | |
| lxc-stop -n jupyter | |
| # Install Jupyter | |
| apt-get update | |
| apt-get install -yq --no-install-recommends \ | |
| wget \ | |
| bzip2 \ | |
| ca-certificates \ | |
| sudo \ | |
| locales \ | |
| nano \ | |
| fonts-liberation \ | |
| python3-pip \ | |
| python3-setuptools \ | |
| build-essential \ | |
| curl \ | |
| gcc g++ make \ | |
| libzmq3-dev | |
| export LANGUAGE=pt_BR.UTF-8 | |
| export LANG=pt_BR.UTF-8 | |
| export LC_ALL=pt_BR.UTF-8 | |
| locale-gen pt_BR.UTF-8 | |
| dpkg-reconfigure locales | |
| echo "America/Sao_Paulo" | sudo tee /etc/timezone | |
| dpkg-reconfigure --frontend noninteractive tzdata | |
| curl -sL https://deb.nodesource.com/setup_12.x | bash - | |
| apt-get install -y nodejs | |
| #curl -L https://npmjs.org/install.sh | sudo sh | |
| pip3 --version | |
| pip3 install --upgrade pip | |
| pip3 install setuptools | |
| pip3 install wheel | |
| pip3 install jupyterlab | |
| apt-get install luarocks | |
| pip3 install ilua | |
| apt-get install texlive-xetex texlive-fonts-recommended texlive-generic-recommended pandoc | |
| pip3 install jupyterlab_latex | |
| jupyter serverextension enable --sys-prefix jupyterlab_latex | |
| jupyter labextension install @jupyterlab/latex | |
| jupyter labextension install @jupyterlab/google-drive | |
| jupyter labextension install @jupyterlab/github | |
| jupyter labextension install jupyterlab-mp4 | |
| pip3 install nbresuse | |
| jupyter serverextension enable --py nbresuse | |
| jupyter labextension install @jupyterlab/statusbar | |
| pip3 install --upgrade jupyterlab-git | |
| jupyter lab build | |
| pip3 install jupyterlab-commenting-service | |
| jupyter labextension install @jupyterlab/commenting-extension | |
| npm config set prefix $HOME | |
| npm config set python /usr/bin/python3.7 | |
| npm install -g ijavascript --unsafe-perm | |
| /root/bin/ijsinstall --install=global --spec-path=full | |
| npm install -g jp-coffeescript --unsafe-perm | |
| /root/bin/jp-coffee-install --install=global --spec-path=full | |
| npm install -g itypescript --unsafe-perm | |
| /root/bin/its --install=global --spec-path=full | |
| pip3 install bash_kernel | |
| python3 -m bash_kernel.install | |
| jupyter labextension update --all | |
| pip3 install --pre jupyterlab-git==0.20.0rc0 | |
| nano /etc/ssh/sshd_config | |
| exit | |
| lxc-stop -n jupyter | |
| lxc-start --name jupyter | |
| cat ~/.ssh/id_rsa.pub | ssh root@jupyter "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| jupyter kernelspec list | |
| # Generate Password hash | |
| python3 | |
| >>> from notebook.auth import passwd; passwd(); exit(); | |
| 'sha1:efc3bc450b78:d299ead28c08f11029e28791308f8431d6e18778' | |
| # make certificate | |
| mkdir ~/certs | |
| cd ~/certs | |
| openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes -keyout jupyter.key -out jupyter.crt -subj /CN=example.com -addext subjectAltName=DNS:jupyter.casa,DNS:jupyter,IP:192.168.1.77 | |
| jupyter lab --allow-root --ip=0.0.0.0 --port=443 --no-browser --notebook-dir=/srv --NotebookApp.password='sha1:efc3bc450b78:d299ead28c08f11029e28791308f8431d6e18778' --NotebookApp.quit_button=False --keyfile=/root/certs/jupyter.key --certfile=/root/certs/jupyter.crt | |
| # check out my start script - change the password | |
| nano /etc/init.d/jupyter | |
| chmod +x /etc/init.d/jupyter | |
| update-rc.d jupyter defaults | |
| service jupyter start | |
| cat /var/log/jupyter.err | |
| cat /var/log/jupyter.log | |
| jupyter notebook --generate-config | |
| # Options files | |
| # --config=/root/.jupyter/jupyter_notebook_config.py | |
| jupyter notebook --help | |
| # Open browser at: | |
| https://jupyter.casa/tree | |
| https://jupyter.casa/lab |
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: jupyter | |
| # Required-Start: $local_fs $network $named $time $syslog | |
| # Required-Stop: $local_fs $network $named $time $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Description: code-server - VS Code on a remote server | |
| ### END INIT INFO | |
| dir="/root" | |
| password="sha1:efc3bc450b78:d299ead28c08f11029e28791308f8431d6e18778" | |
| user="root" | |
| server="0.0.0.0" | |
| port="443" | |
| name=`basename $0` | |
| pid_file="/var/run/$name.pid" | |
| stdout_log="/var/log/$name.log" | |
| stderr_log="/var/log/$name.err" | |
| cmd="/usr/local/bin/$name lab --allow-root --ip=$server --port=$port --no-browser --NotebookApp.password='$password' --NotebookApp.quit_button=False --certfile=$dir/certs/$name.crt --keyfile=$dir/certs/$name.key --notebook-dir=/srv --config=/root/.jupyter/jupyter_notebook_config.py" | |
| #jupyter lab --allow-root --ip=0.0.0.0 --port=443 --no-browser --notebook-dir=/srv --NotebookApp.password='sha1:efc3bc450b78:d299ead28c08f11029e28791308f8431d6e18778' --NotebookApp.quit_button=False --keyfile=/root/certs/jupyter.key --certfile=/root/certs/jupyter.crt | |
| get_pid() { | |
| cat "$pid_file" | |
| } | |
| is_running() { | |
| [ -f "$pid_file" ] && ps -p `get_pid` > /dev/null 2>&1 | |
| } | |
| case "$1" in | |
| start) | |
| if is_running; then | |
| echo "Already started" | |
| else | |
| echo "Starting $name" | |
| cd "$dir" | |
| if [ -z "$user" ]; then | |
| sudo $cmd >> "$stdout_log" 2>> "$stderr_log" & | |
| else | |
| sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" & | |
| fi | |
| echo $! > "$pid_file" | |
| if ! is_running; then | |
| echo "Unable to start, see $stdout_log and $stderr_log" | |
| exit 1 | |
| fi | |
| fi | |
| ;; | |
| stop) | |
| if is_running; then | |
| echo -n "Stopping $name.." | |
| kill `get_pid` | |
| for i in 1 2 3 4 5 6 7 8 9 10 | |
| # for i in `seq 10` | |
| do | |
| if ! is_running; then | |
| break | |
| fi | |
| echo -n "." | |
| sleep 1 | |
| done | |
| echo | |
| if is_running; then | |
| echo "Not stopped; may still be shutting down or shutdown may have failed" | |
| exit 1 | |
| else | |
| echo "Stopped" | |
| if [ -f "$pid_file" ]; then | |
| rm "$pid_file" | |
| fi | |
| fi | |
| else | |
| echo "Not running" | |
| fi | |
| ;; | |
| restart) | |
| $0 stop | |
| if is_running; then | |
| echo "Unable to stop, will not attempt to start" | |
| exit 1 | |
| fi | |
| $0 start | |
| ;; | |
| status) | |
| if is_running; then | |
| echo "Running" | |
| else | |
| echo "Stopped" | |
| exit 1 | |
| fi | |
| ;; | |
| *) | |
| echo "Usage: $0 {start|stop|restart|status}" | |
| exit 1 | |
| ;; | |
| esac | |
| exit 0 |
https://towardsdatascience.com/jupyter-notebook-best-practices-f430a6ba8c69
toc2 = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/toc2/README.html
collapsible headings = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/collapsible_headings/readme.html
default template = https://towardsdatascience.com/set-your-jupyter-notebook-up-right-with-this-extension-24921838a332
snippets = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/snippets/README.html
autoreload = https://ipython.readthedocs.io/en/stable/config/extensions/autoreload.html
testing = https://pypi.org/project/ipytest/
style guide = https://www.python.org/dev/peps/pep-0008/
codefolding = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/codefolding/readme.html
hide inputall = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/hide_input_all/readme.html
variable inspector = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/varInspector/README.html
split cells = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/splitcell/readme.html
list of neextensions = https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions.html
widgets (gui interface) = https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Basics.html
progress bar = https://github.com/tqdm/tqdm#ipython-jupyter-integration
Joel Grus’ famous I Don’t Like Notebooks
https://docs.google.com/presentation/d/1n2RlMdmv1p25Xy5thJUhkKGvjtV-dkAIsUXP-AL4ffI/
take a look at: https://github.com/jupyter/docker-stacks/blob/master/base-notebook/Dockerfile
https://jupyter-notebook.readthedocs.io/en/stable/config.html