yum -y install sqlite-devel
#在安装Python
以前执行,ipython notebook
依赖sqlite
执行
pip install ipython
pip install notebook
pip install pysqlite
#ipython notebook
依赖sqlite
数据库,必须安装后才能使用python
[错误处理]
若是安装
sqlite-devel
后,执行命令
ipython notebook
仍然出现下面的错误
"没有名字为_sqlite3
的模块",通常来讲须要从新编译python环境而后使用下面的命令拷贝sqlite.so
文件到系统目录
cp /usr/local/src/Python-2.7.8/build/lib.linux-i686-2.7/_sqlite3.so /usr/local/lib/python2.7/sqlite3/
拷贝过去后,从新执行
ipython notebook
#此时应该能够正常运行linux
ipython notebook
的登陆密码import IPython IPython.lib.passwd('yourpassword')
ipython notebook
的管理#添加程序到supervisor [program:notebook]
command = ipython notebook --notebook-dir=/R3/notebook/notebook/ --ip=ip_addr --no-mathjax --no-browser --NotebookApp.password=sha1:5 2de8d6f2ea6:90387094a062f493e7eea3df503c28ab3c3b8bf1 directory=/R3/notebook
stopsignal=QUIT
autostart=true
autorestart=true
startsecs=10
startretries=36
stdout_logfile=/R3/logs/ipython_check.log
stdout_logfile_backups=10
stdout_logfile_maxbytes=10MB
stderr_logfile=/R3/logs/ipython_check_err.log
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=10
loglevel=infonginx
[
command
说明]
- --notebook-dir 指定notebook的工做目录
- --ip=169.24.2.82 指定notebook的服务器IP地址
- --no-mathjax 禁止联网下载math的js
- --no-browser 禁止启动时打开浏览器
- --NotebookApp.password 指定用户密码(上述中建立的密码)
关于supervisor
的安装配置及管理可参见官方站点web
将下面的命令添加到
/etc/rc.local
文件中
su - george -c 'supervisord -c /etc/supervisor.conf'
每次启动后会自动启动supervisord进程,由该进程服务对ipython notebook
进程进行管理sql
netstat -tunl|grep 8888
检查服务器是否在8888
端口进行监听- 检查防火墙是否受权
8888
端口对外提供服务- 浏览器中输入
http://ip:8888/
会自动跳转到要求输入密码
**建议使用Firefox浏览器进行访问**
Nginx
使其支持notebook
的反向代理
location
/ {
proxy_pass http://ip:8888
;
proxy_set_header Host
$http_host;
proxy_http_version 1.1
;
proxy_set_header Upgrade $http_upgrade
;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400; }数据库
**本质上notebook
的通信机制是使用websocket
,在nginx
的配置上要让其支持websocket
才行
proxy_set_header Connection "$Upgrade"
表示其支持websocket
**浏览器