vps配置jupyterlab远程访问服务
撸了个小鸡鸡,打算用来做jupyter server,在此记录下此次配置全过程。
安装JupyterLab
# 更新系统
apt update&&apt upgrade -y
# 安装python
apt install python3
#安装JpyterLab和中文语言
pip3 install jupyterlab jupyterlab-language-pack-zh-CN
配置jupyterlab
生成配置文件,存放路径为.jupyter/jupyter_lab_config.py
root@hcss-ecs-279f:~# jupyter lab --generate-config
Writing default config to: /root/.jupyter/jupyter_lab_config.py
编辑配置文件vi .jupyter/jupyter_lab_config.py
,参考以下配置
# 允许任意IP访问
c.ServerApp.allow_origin = '*'
c.ServerApp.ip = '0.0.0.0'
# 自定义端口号
c.ServerApp.port = 8888
# 允许root运行
c.ServerApp.allow_root = True
下来设置访问密码
root@hcss-ecs-279f:~# jupyter lab password
Enter password:
Verify password:
[JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json
然后就可以使用jupyter lab
来运行服务。
root@hcss-ecs-279f:~# jupyter lab
... ...
[I 2025-04-10 10:41:35.533 ServerApp] jupyterlab | extension was successfully loaded.
[I 2025-04-10 10:41:35.536 ServerApp] notebook | extension was successfully loaded.
[I 2025-04-10 10:41:35.537 ServerApp] Serving notebooks from local directory: /root
[I 2025-04-10 10:41:35.537 ServerApp] Jupyter Server 2.15.0 is running at:
[I 2025-04-10 10:41:35.537 ServerApp] http://hcss-ecs-279f:9876/lab
[I 2025-04-10 10:41:35.537 ServerApp] http://127.0.0.1:9876/lab
... ...
按提示通过IP:9876
方式来远程访问JupyterLab服务即可。
使用JupyterLab
首次访问会提示输入密码,登录完后即可打开jupyterlab。
设置中文语言,settings->language->Chinese
退出系统,文件->注销
#Debian #Vps #Screen #Linux #Jupyter #Jupyterlab #Python #Python3