AiiDA Standalone installation 4/4: jupyter
==========================================
###### tags: `chapter`, `aiida`, `aiida-kkr`, `by-wasmer`, `private`, `from-2020-10`, `to-2020-11`, `log`, `installation`, `jupyter`, `ssh`
[up <i class="fa fa-arrow-up"></i> AiiDA](https://iffmd.fz-juelich.de/WxOZ75GTTHu2MNmnw2u5pA#AiiDA)
Created: 2020-10, wasmer.
Last modified: 2022-01, wasmer.
Decription: This is part of a set of installation log notebooks about how to perform and maintain a standalone installation of AiiDA 1.x on an iff workstation in general, and the plugin AiiDA-KKR specifically, for running calculations on the RWTH CLAIX cluster. However, it should be useful / adaptable to any computer, AiiDA plugin, and cluster.
## Table of Contents
[TOC]
## References
- [[wasmer_home_dir]](https://iffgit.fz-juelich.de/wasmer/home) with the `~/.bash*` config files mentioned throughout
- [ruess_claix-setup-pics](https://iffcloud.fz-juelich.de/f/20683333). pics from claix setup tutorial meeting with ruess (internal iffcloud link)
- [benjlindsay_jupyter-remotely](https://benjlindsay.com/posts/running-jupyter-lab-remote)
## First attempt SUCCESS
works with combination of [ruess_claix-setup-pics] (ssh options instead of those from benjlindsay) and [benjlindsay_jupyter-remotely] (all the rest).
In `iff734` `~/.bashrc`:
```shell
# in screen session screen_jupyter: open jupyter-lab tunnel for laptop:
alias jupyterlab_tunnel='jupyter lab --no-browser --port=5678'
```
In laptop `~/.bashrc`:
```
# from benjlindsay (function), ruess (ssh options)
# 1) on iff734, in screen screen_jupyter, start jupyterlab_tunnel
# 2) here, call function. should open jupyterlab in browser
# 3) on first call, copy-paste token and set password. next login token not needed anymore.
# 3) when done, quit with Ctrl+C.
function jupyterlab_tunnel_iff734 {
port=5678
remote_username=wasmer
remote_hostname=iff734_via_iff
url="http://localhost:$port"
echo "Opening $url"
firefox -new-tab "$url"
cmd="ssh -v -N -f -L localhost:"$port":localhost:"$port" $remote_username@$remote_hostname" ## ruess
# cmd="ssh -CNL localhost:"$port":localhost:"$port" $remote_username@$remote_hostname" ## benjlindsay
echo "Running '$cmd'"
eval "$cmd"
}
```
Usage:
Asuming long-term claix tunnel session is running on `iff734`:
```shell
$ source ~/.bash_login
$ source ~/.bashrc
$ start_env_aiida_kkr
$ screen -r screen_ssh_tunnel_claix_aiida
$ ssh_tunnel_claix_aiida
# C-a d (screen detach, back to shell)
```
Then start long-term jupyter tunnel session on `iff734`:
```shell
$ screen -r jupyter
$ jupyterlab_tunnel
# C-a d (sreen detach, back to shell)
```
Then connect to it on laptop:
```shell
$ jupyterlab_tunnel_iff734
# jupyter opens in browser
```