我的个人博客:https://lixiaohui.live
来源:https://hsaghir.github.io/data_science/jupyter-notebook-on-a-remote-machine-linux/
1 - Open an SSH tunnel that forwards the port setup for Jupyter Notebook on the remote machine to a port on the local machine so that we can access it using our local browser
hamid@local_host$ ssh user@remote_host
user@remote_host$ jupyter notebook --no-browser --port=8889
This runs a jupyter notebook server on the remote machine on port:8889 without opening a browser since we will use the browser on our local machine to connect to this.
2- In a new terminal window on your local machine, SSH into the remote machine again using the following options to setup port forwarding.
hamid@local_host$ ssh -N -L localhost:8888:localhost:8889 user@remote_host
-N options tells SSH that no commands will be run and it’s useful for port forwarding, and -L lists the port forwarding configuration that we setup.
3- Access the remote jupyter server via your local browser. Open your browser and go to:
localhost:8888
To close the SSH tunnel simply do ctrl-c.