内网服务器部署Jupyter Lab

安装

workon <virtual environment's name>
pip install jupyter jupyterlab

配置

在交互式命令行环境下配置密码,获取密码的hash值

from notebook.auth import passwd; passwd()

生成配置文件,并在~/.jupyter/jupyter_notebook_config.py文件内进行配置

jupyter lab --generate-config
vim ~/.jupyter/jupyter_notebook_config.py
python
c.NotebookApp.ip = '*'              # 允许从任意 IP 访问
c.NotebookApp.open_browser = False  # 运行 notebook 应用时不打开浏览器
c.NotebookApp.password = ''       # 密码的 hash 值
c.NotebookApp.port = 28888          # 运行端口

启动服务

先进入tmux session中或使用nohup命令工具使得程序在后台运行,这里使用的是tmux

tmux new -s jupyterlab
jupyter lab

完毕。

参考资料

  • https://bitmingw.com/2017/07/09/run-jupyter-notebook-server/
  • https://www.digitalocean.com/community/tutorials/how-to-install-run-connect-to-jupyter-notebook-on-remote-server
  • https://jupyter-notebook.readthedocs.io/en/stable/public_server.html

你可能感兴趣的:(Linux)