Linux 服务器设置 Jupyter-Notebook 远程连接

Linux服务器Jupyter-Notebook 远程连接设置

重点参考自 Jupyter notebook连接远程服务器和配置Anaconda环境简单教程

1、首先要在Linux服务器上安装Jupyter notebook。
安装Jupyter notebook:

pip install Jupyter

2、生成Jupyter notebook 配置文件

jupyter notebook --generate-config

3、配置Jupyter notebook密码

jupyter notebook password
Enter password: ****(自定义)
Verify password: ****

新版的Jupyter notebook只需要输入密码确认,然后它会自动帮你把生成含有密码的hash码输入进jupyter_notebook_config.json 文件。

4、配置 jupyter_notebook_config.py 文件

进入vim编辑器对jupyter_notebook_config.py 进行编辑。

vim ~/.jupyter/jupyter_notebook_config.py

取消以下配置的注释,并修改内容如下:

c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
c.NotebookApp.ip = ‘*’
c.NotebookApp.allow_root = True
c.NotebookApp.port = 8888 # 其实这个我不知道有用木,因为我后来是指定端口启动的

注意!!!
取消注释时修改代码一定要左侧顶格,不然会报错!!!

5、在Linux控制台输入命令启动服务

jupyter notebook --no-browser --port=80 --ip=0.0.0.0

其中,
–no-browser:表示Linux服务器不自动弹出浏览器。
–port=80 --ip=0.0.0.0:80表示jupyter服务将启动在80端口,0.0.0.0表示允许任何主机访问。

6、本地使用Linux服务器的jupyter

在本地浏览器输入

http://(服务器ip地址):80(端口号)

输入密码登录,即可远程使用。

猜你喜欢

转载自blog.csdn.net/weixin_43479947/article/details/131338997