背景
服务器上配置jupyter notebook以后台服务进程方式启动,默认启动时不调用服务器端的浏览器。
步骤
生成配置文件
jupyter notebook --generate-config
生成登陆密码
$ ipython
在ipython
的交互式shell中,输入命令
$ from notebook.auth import passwd
$ passwd()
得到密码。
配置jupyter登陆信息
vim
打开~/.jupyter/jupyter_notebook_config.py
配置文件,修改其内容:
-
将
c.NotebookApp.allow_remote_access
设置为True,默认时False,且被#注释了
-
设置
c.NotebookApp.password
为在ipython
环境中生成的密码hash值
-
将
c.NotebookApp.ip
设置为’*',默认是"localhost"
-
设置
c.NotebookApp.open_browser
为False
,设置启动notebook时默认不打开浏览器
以上设置完成后,就可以在服务器上启动 jupyter notebook
启动jupyter notebook服务程序
$ jupyter notebook
浏览器登录
在客户端浏览器中输入服务器ip+port来登陆jupyter notebook服务。