Linux服务器上配置Jupyter进行远程登入并在后台运行
1,安装Jupyter
pip installer Jupyter notebook
2,生成配置文件
jupyter notebook --generate-config --allow-root
在根目录会生成.jupyter文件,是隐藏的
3,生成用于登录 的密码
jupyter notebook password
输入密码并再次确认密码一致
enter password
verify password
4,修改配置文件
c.NotebookApp.ip='*' # 星号代表任意ip,这个跟mysql的权限设置一样,所以说知识是互通的
c.NotebookApp.allow_remote_access = True # 运行远程登入
c.NotebookApp.port =9999 # 端口号设置为9999
5,启动Jupyter
jupyter notebook --allow-root &
6,即可通过浏览器访问Jupyter
地址为服务器ip+端口号(IP:端口)
7,后台运行Jupyter
在云服务器中搭建好jupyter将其关闭,终端输入以下代码(推荐第二种,第一种终端关了jupyter也关了,第二种一直开着,除非手动关闭)
第一种:
jupyter notebook --allow-root > jupyter.log 2>&1 &
第二种:
nohup jupyter notebook --allow-root > jupyter.log 2>&1 &
8,关闭后台运行的Jupyter
可以显示这个进程的pid.
ps -a
kill掉Jupyter进程
kill -9 PID