一、Centos7安装Anaconda
安装过程,这个文章写得很好:链接地址




二、修改配置文件(参考文章)
下文中的例子在 root 账户下进行,建议实际不要用 root 用户。



下图箭头指向的三个地方是自己的东西,如何获取看后面的截图:


第六行的 certfile 证书文件可以通过下面这行命令生成(中间的交互信息可以随便填),注意路径要对应上:
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

第七行的 port 应该是一个未被占用的、被防火墙允许的端口:
所以要提前开放一个端口,这里开放的是8888:



[root@VM_157_11_centos .jupyter]# jupyter notebook --config jupyter_notebook_config.py --allow-root
nohup jupyter notebook --config jupyter_notebook_config.py --allow-root 2>&1 > my.log &
用第一种方式运行:

由于我们生成的 SSL 证书是非正式签发的,所以Chrome等浏览器可能会提示“您的连接不是私密连接”之类的风险问题,这里选“高级” – “继续前往”就好了。


三、使用
每次登陆云服务器后直接使用下面的命令 :
jupyter notebook --config jupyter_notebook_config.py --allow-root

解决方法:

cd /root/.jupyter/
jupyter notebook --config jupyter_notebook_config.py --allow-root

jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
为了能够不用每次都启动服务,或防止运行的代码因SSH中断而停止,可以使用命令以下进行设置:
nohup jupyter notebook --ip=0.0.0.0 --no-browser --allow-root &
注:
1、nohup 能忽略SIGHUP信号,即关闭shell, 进程还是存在( 但受Ctrl C影响
2、& 能让程序后台运行,不受ctrl C的影响(但关掉shell,进程终止)
3、两者配合后,即使关闭了命令窗口,同样可以访问。若要停止服务,只能手动关闭。
三、安装tensorflow

网友评论