centos7搭建JupyterLab平台,并开启远程访问

1. jupyterlab介绍

    1.1 用来取代Jupyter Notebook的一个基于Web的用户交互式用户界面。相当于增强版的Jupyter Notebook。

    1.2 相较于Jupyter Notebook,在JupyterLab里除了建立传统的Jupyter笔记(Jupyter Notebook),还文本编辑器、终端(terminal)、方便易用的文件浏览器。

    1.3 作为文本编辑器,除了编辑文本文件外,还可预览excel文件、csv文件、图片文件、json文件等。

    1.4 JupyterLab非常适合数据分析、教程编写等任务。

2. 安装jupyter

    2.1 安装python3

    2.2 pip3安装jupyter

    pip3 install jupyterlab

[root@iZuf62qojdpdfmeohedn2jZ /]# pip3 install jupyterlab

3. 生成密钥(注意:两次输入的密码都是没有显示的

[root@iZuf62qojdpdfmeohedn2jZ /]# ipython
Python 3.6.4 (default, Apr 10 2020, 10:25:04) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from notebook.auth import passwd

In [2]: passwd()
Enter password: 
Verify password: 
Out[2]: '这里输出的是密钥,配置文件中要用到'

4. 生成jupyter lab 的配置文件

    jupyter lab --generate-config

[root@iZuf62qojdpdfmeohedn2jZ /]# jupyter lab --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
[root@iZuf62qojdpdfmeohedn2jZ /]#

5. 编辑配置文件

[root@iZuf62qojdpdfmeohedn2jZ /]# cd /root/.jupyter/
[root@iZuf62qojdpdfmeohedn2jZ .jupyter]# ls
jupyter_notebook_config.py
[root@iZuf62qojdpdfmeohedn2jZ .jupyter]# vim jupyter_notebook_config.py

修改以下配置项:

c.NotebookApp.ip = '*'
# 这里的密码填写上面生成的密钥
c.NotebookApp.password = '密钥' 
# 禁止用host的浏览器打开jupyter
c.NotebookApp.open_browser = False 
# 打开jupyter lab的端口,端口自定义
c.NotebookApp.port = 9010
# 允许远程访问 
c.NotebookApp.allow_remote_access = True

如果嫌一个一找太麻烦的话,可以直接把这段配置代码粘贴进去

6. 启动jupyterlab

[root@iZuf62qojdpdfmeohedn2jZ /]# jupyter lab
[W 11:04:03.104 LabApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 11:04:03.111 LabApp] JupyterLab extension loaded from /usr/local/python3/lib/python3.6/site-packages/jupyterlab
[I 11:04:03.111 LabApp] JupyterLab application directory is /usr/local/python3/share/jupyter/lab
[C 11:04:03.114 LabApp] Running as root is not recommended. Use --allow-root to bypass.
[root@iZuf62qojdpdfmeohedn2jZ /]# 

    报错,原因是权限不够。后边加上 --allow-root 即可

[root@iZuf62qojdpdfmeohedn2jZ /]# jupyter lab --allow-root
[W 11:08:55.110 LabApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 11:08:55.116 LabApp] JupyterLab extension loaded from /usr/local/python3/lib/python3.6/site-packages/jupyterlab
[I 11:08:55.116 LabApp] JupyterLab application directory is /usr/local/python3/share/jupyter/lab
[I 11:08:55.119 LabApp] Serving notebooks from local directory: /
[I 11:08:55.119 LabApp] Jupyter Notebook 6.1.4 is running at:
[I 11:08:55.119 LabApp] http://iZuf62qojdpdfmeohedn2jZ:9010/
[I 11:08:55.119 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

    注意:http://iZuf62qojdpdfmeohedn2jZ:9010/ 不是最终要访问的地址

    启动成功!但是远程访问不了,原因是阿里云服务器实例上未开启9010端口,去阿里云开启一下9010端口即可

7. 阿里云开启映射端口

    7.1 登录阿里云账号

    7.2 点击进入实例详情=====>本实例安全组=====>配置规则

开放端口:

8. 重启jupyterlab

[root@iZuf62qojdpdfmeohedn2jZ /]# jupyter lab --allow-root

浏览器输入: http://服务器公网IP:9010/,输入密码之后即可访问

大功告成!!!

### 如何在服务器上安装和配置 DeepSeek 工具 #### 环境准备 为了确保顺利部署 DeepSeek,在开始之前需准备好相应的环境。这通常涉及操作系统的选择以及必要的依赖项安装[^1]。 对于 CentOS 服务器而言,具体的操作命令能够简化这一过程实现自动化部署。利用 Docker Compose 可以轻松管理多容器的应用程序栈,从而使得启动整个 DeepSeek 服务变得简单快捷。执行如下指令即可完成服务的启动,且可以根据需求调整 `ollama-server` 实例的数量来优化性能表现[^2]: ```bash docker-compose up -d --scale ollama-server=3 ``` #### 部署于腾讯云 HAI 服务器 当目标平台为腾讯云HAI服务器时,则有更为详细的指导手册可供参考。该指南不仅涵盖了从选购合适的服务实例直至最终上线使用的全流程介绍;还特别提到了借助多种开发与调试工具(如 ChatBotUI, JupyterLab 或 CloudStudio),帮助用户更便捷地管理和测试已部署的大规模预训练模型——DeepSeek-R1。这些工具提供了图形化界面和支持远程访问的功能,极大地提高了工作效率和用户体验感[^3]。 #### 安全性和便利性的考量 尽管官方提供了一款易于使用的网页聊天机器人及移动端App作为默认交互方式之一,但对于某些特定应用场景来说,在私有环境中独立架设或许会带来额外的安全保障和技术灵活性上的优势。因此了解如何自行搭建一套完整的解决方案显得尤为重要[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值