安装基础包:yum groupinstall "Development tools"
一、pip安装
1. 安装python
需要2.7版本的python,如果centOS自带的是2.7的则不需安装(centOS7自带了2.7.5)
① 下载 python
https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
# tar xf Python-2.7.9.tar.xz
# cd Python-2.7.9
# make && make altinstall
# ln -s /usr/local/bin/python2.7 /usr/local/bin/python
④ 测试
# python -V
② 解压
③ 编译安装
# ./configure --prefix=/usr/local
2. 安装pip
首先
# yum install epel-release
然后
# yum install python-pip
3. 安装caravel
① 获得caravel源码
# wget https://github.com/airbnb/caravel/archive/master.zip
② 解压
# unzip caravel-master.zip
③ 安装
进入根目录,使用pip命令安装(考虑到境外服务器太慢,这里使用清华大学的源)
# pip install . -i https://pypi.tuna.tsinghua.edu.cn/simple/
4. 错误(如果有错误执行下面的)
① cffi
yum install libffi-devel
② sasl
yum install libgsasl-devel
yum install libmemcached-devel
③ python
yum install python-devel
④ openssl
yum install openssl-devel
⑤ pytz
pip install --upgrade pytz
⑥ npy_math.py
yum install numpy
yum install openssl
二、nmp安装
1. 安装nodejs
下载node-v4.5.0.tar.gz(官网)解压
# ./configure --prefix=/usr/local
# make
# make install
# ln -s /usr/local/bin/node /usr/bin/node
2. 安装npm
根据网址下载 install.sh (https://npmjs.org/install.sh)
# sh install.sh
3. 安装express
# npm install express -g
4. 安装caravel(源码安装)
## assuming $CARAVEL_HOME as the root of the repo
# cd $CARAVEL_HOME/caravel/assets
# npm install
# npm run prod
# cd $CARAVEL_HOME
# python setup.py install
三、初始化运行
创建admin用户# fabmanager create-admin --app caravel
初始化caravel元数据
# caravel db upgrade
初始化caravel默认的用户角色和权限
# caravel init
加载示例数据
# caravel load_examples
定义运行端口
# caravel runserver -p 8088
通过http://localhost:8088就可访问
四、连接数据源
yum install build-dep python-psycopg2
pip install psycopg2
2. MysqL
yum install MysqL-python
database | pypi package | sqlAlchemy URI prefix |
---|---|---|
MysqL | pipinstallMysqLclient |
MysqL:// |
Postgres | @H_364_301@pipinstallpsycopg2 @H_364_301@postgresql+psycopg2://||
Presto | pipinstallpyhive | presto:// |
Oracle | @H_364_301@pipinstallcx_Oracle @H_364_301@oracle://||
sqlite | sqlite:// | |
Redshift | @H_364_301@pipinstallsqlalchemy-redshift @H_364_301@redshift+psycopg2://||
MSsql | pipinstallpymssql | mssql:// |
Impala | @H_364_301@pipinstallimpyla @H_364_301@impala://||
Sparksql | jdbc+hive:// |
linux环境下安装MysqL-python的两种方式
第一种 简单:yum install MysqL-python
第二种:复杂:需要自己源码编译,依赖包比较多
a. gcc
b.setuptools
c.python-dev
A.下载:wgethttp://sourceforge.net/projects/mysql-python/files/latest/download