1.新建一个环境
conda create -n llm_env python=3.12
2.安装ipykernel
conda install ipykernel
3.将待加入的环境添加到jupyter notebook
root 用户
python -m ipykernel install --name llm_env
普通用户
python -m ipykernel install --user --name llm_env
4.生成jupyter 配置文件
jupyter lab --generate-config
5.设置远程登陆jupyter lab的密码
jupyter lab password
Enter password: **** # 以后网页通过这个密码才可访问jupyter web
Verify password: ****
6.修改第1步中的配置文件
vim ~/.jupyter/jupyter_notebook_config.py
c.ServerApp.allow_remote_access = True # 允许使用远程访问
c.ServerApp.allow_root = True # 允许使用root
c.ServerApp.ip = '*' # 监听所有ip
c.ServerApp.open_browser = False # 服务器端默认启动jupyter时不自动打开浏览器
c.ServerApp.port = 8888 # 服务器端口号,可自行设置
c.ServerApp.notebook_dir = u'需要默认的路径'
7.在linux服务器后台运行jupyter
nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
8.本地访问
http://公网ip:8888/
输入密码即可