linux的jupyter设置外网访问
时间: 2023-10-27 09:22:22 浏览: 195
Linux虚拟机设置IP访问外网
要在Linux上设置Jupyter允许外网访问,需要进行以下步骤:
1. 配置Jupyter的配置文件:进入到pip可执行文件所在文件夹下,生成Jupyter的配置文件。配置文件将会生成到家目录的.jupyter文件夹下。可以使用以下命令来生成配置文件:
```
jupyter-notebook --generate-config
```
2. 配置Jupyter的密码:默认情况下,配置文件`~/.jupyter/jupyter_notebook_config.py`可能不存在,需要自行创建。可以使用以下命令来生成配置文件:
```
jupyter notebook --generate-config
```
3. 开启Jupyter的默认运行端口:如果开启了防火墙,需要将Jupyter的默认运行端口添加到防火墙配置中。可以使用以下命令来添加Jupyter的默认运行端口:
```
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --reload
```
4. 启动Jupyter:使用以下命令启动Jupyter服务,并将输出日志写入到`/home/my_user/.jupyter/jupyter.log`文件中:
```
nohup jupyter-notebook >> /home/my_user/.jupyter/jupyter.log 2>&1 &
```
5. 安装Nbextensions扩展包:使用以下命令安装Nbextensions扩展包,并启用codefolding扩展:
```
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
jupyter nbextension enable codefolding/main
```
这样,你就可以在Linux上设置Jupyter允许外网访问了。请确保你已经正确配置了防火墙和网络环境,以便外部网络可以访问到Jupyter服务。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [笔记|Jupyter|Linux 环境下安装 Jupyter 并远程访问](https://blog.csdn.net/Changxing_J/article/details/129737012)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [[1026]设置 jupyter notebook 外网远程访问](https://blog.csdn.net/xc_zhou/article/details/118884701)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文