1. Jupyter Notebook / JupyterLab
Jupyter 是一个非常流行的交互式开发环境,支持多种编程语言(如 Python、R、Julia 等),并且可以通过 Web 浏览器进行访问和使用。
步骤:
-
安装 Jupyter:
在服务器上安装 Jupyter Notebook 或 JupyterLab:sudo apt update sudo apt install python3-pip pip3 install jupyterlab
-
启动 JupyterLab:
启动 JupyterLab 并指定监听所有 IP 地址(即使是远程访问):jupyter-lab --ip=0.0.0.0 --port=8888 --no-browser
这将在服务器上启动 JupyterLab,监听端口
8888
,并允许所有 IP 地址访问。 -
访问 JupyterLab:
打开浏览器并访问http://<server-ip>:8888
,你将看到 JupyterLab 的界面。如果是首次启动,Jupyter 会提供一个访问令牌(token)作为安全验证。 -
设置密码(可选):
如果你想避免每次都使用令牌,可以设置密码。首先生成配置文件:jupyter-lab notebook --generate-config
编辑配置文件:
nano ~/.jupyter/jupyter_notebook_config.py
修改为:
c = get_config() #noqa
c.ServerApp.allow_remote_access = True
c.ServerApp.token = ‘youtoken’
```bashsudo nano /etc/systemd/system/jupyterlab.service
[Unit]
Description=Jupyter Lab
After=network.target[Service]
Type=simple
User=你的用户名
WorkingDirectory=/home/你的用户名
ExecStart=/usr/bin/jupyter lab --no-browser --ip=0.0.0.0 --port=8888
Restart=always
Environment=PATH=/home/你的用户名/.local/bin:/usr/bin:/bin[Install]
WantedBy=multi-user.target