linux jupyter notebook 远程 浏览器 window客户端访问 配置方法

基础条件:linux 系统里安装有:
Anaconda
jupyter notebook
python(或者ipython)

配置jupyter notebook远程
0.登录你的远程服务器

1.生成配置文件(Linux服务器)

jupyter notebook --generate-config

2.生成密文码(Linux服务器)

使用ipython或者python生成密文码

$ipython
In [1]: from notebook.auth import passwd

In [2]: passwd()
Enter password:
Verify password:
Out[2]:'sha1:4dc3f1c01ae4:0dafee9e1bd3a810911a04fbbea5278e8375ae3'

‘sha1:4dc3f1c01ae4:0dafee9e1bd3a810911a04fbbea5278e8375ae3’
此为生成的密文码结果,保存,用于第3步。

3.修改配置文件(Linux服务器)

vim ~/.jupyter/jupyter_notebook_config.py 

在打开的文件头部添加如下字段,后保存退出:

c.NotebookApp.ip='*' #  ‘’*‘’为任意IP访问的意思
c.NotebookApp.password = u'sha1:4dc3f1c01ae4:0dafee9e1bd3a810911a04fbbea5278e8375ae3' #第2步生成的密文码
c.NotebookApp.open_browser = False  #默认不打开
c.NotebookApp.port = 999 	#指定你计划用window 浏览器访问的端口,可能会被占用,服务器会自动推荐端口给你
c.NotebookApp.allow_remote_access = True     #接受远程访问权限

4、启动jupyter (Linux服务器)

前台运行模式:

jupyter notebook

后台运行模式(可以进行多任务):

nohup jupyter notebook &

5.远程浏览器访问

假定Linux服务器IP:
192.168.12.13
刚才设置的端口:
999
则在浏览器里输入网址,进行搜索:

http://192.168.12.13:999

6、运行结果

在这里插入图片描述
在这里插入图片描述
这个我们设置的端口(999)出现被人占用的情况,系统自动推荐了1045端口给我们。
再次在浏览器输入:

http://192.168.1.23:1045

在这里插入图片描述

登录成功!

参考:
https://vatlab.github.io/sos-docs/running.html#content
https://blog.csdn.net/w5688414/article/details/82927564
https://blog.csdn.net/tuzixini/article/details/79105482
https://blog.csdn.net/cc1949/article/details/79095494
https://blog.csdn.net/u011253734/article/details/69525690

猜你喜欢

转载自blog.csdn.net/qq_40256654/article/details/86468061
今日推荐