本文以本地MBP连接Lonestar5为例。

1.在服务器端启动Jupyter Notebook

login2.ls5(1018)$ module load python3
login2.ls5(1018)$ jupyter notebook
[I 22:42:30.787 NotebookApp] Serving notebooks from local directory: /scratch/06660/hengkai/WORK/Models/CRCM/run/np09/archive/ROMS_output_z
[I 22:42:30.787 NotebookApp] The Jupyter Notebook is running at:
[I 22:42:30.787 NotebookApp] http://localhost:8888/?token=916a51086f07a2d8b726befe084747743b71bdc201954426
[I 22:42:30.787 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 22:42:30.787 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=916a51086f07a2d8b726befe084747743b71bdc201954426

注意最后一行的端口号8888和token916a51086f07a2d8b726befe084747743b71bdc201954426

2.新开一个终端完成映射

>> ssh hengkai@ls5.tacc.utexas.edu -N -L localhost:8889:localhost:8888

Lonestar 5 is now enforcing Multi-Factor Authentication.  To access the system:

1) If not using ssh-keys, please enter your TACC password at the password prompt
2) At the TACC Token prompt, enter your 6-digit code followed by <return>.
TACC Token Code:

此处8889为本机端口号,8888为服务器端端口号,输入密码后命令号无显示属正常现象。

3.在本机浏览器窗口打开

在本机服务器输入地址localhost:8889,然后输入token即可。

P.S.

值得注意的一点是,开启的两个终端,使用ssh登录的远程服务器必须是同一个登录节点,比如都是login1,因此一个简单的方法,可以在.bashrc或.zshrc里增加以下2行,以确保是同一个登录节点。

 alias ls51='ssh -X -Y hengkai@login1.ls5.tacc.utexas.edu'
 alias ls51jupyter='ssh hengkai@login1.ls5.tacc.utexas.edu -N -L localhost:8889:localhost:8888'

参考:https://blog.csdn.net/Irene_Loong/article/details/81531268

Last modification:January 15th, 2020 at 07:45 pm
If you think my article is useful to you, please feel free to appreciate