1. 程式人生 > >centos 7 下 安裝配置 caravel

centos 7 下 安裝配置 caravel

安裝基礎包: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就可訪問

四、連線資料來源

1. postgresql
   yum install build-dep python-psycopg2
pip install psycopg2
2. mysql
    yum install MySQL-python
database pypi package SQLAlchemy URI prefix
MySQL pip install mysqlclient mysql://
Postgres pip install psycopg2 postgresql+psycopg2://
Presto pip install pyhive presto://
Oracle pip install cx_Oracle oracle://
sqlite sqlite://
Redshift pip install sqlalchemy-redshift redshift+psycopg2://
MSSQL pip install pymssql mssql://
Impala pip install impyla impala://
SparkSQL pip install pyhive jdbc+hive://
注意如果連線資料來源報錯如連線mysql資料來源報錯 importError no moduel MySQLdb解決辦法如下:

linux環境下安裝MySQL-python的兩種方式

第一種 簡單:yum install MySQL-python

第二種:複雜:需要自己原始碼編譯,依賴包比較多

a.   gcc

b.   setuptools

c.  python-dev

第二章詳細步驟如下: B. $ tar xfz MySQL-python-1.2.3.tar.gz
$ cd MySQL-python-1.2.3
$whereis  mysql_config  mysql_config: /usr/bin/mysql_config
$ vim site.cfg
修改mysql_config為mysql配置檔案的路徑 /usr/bin/mysql_config 
還要修改  threadsafe = False
$ python setup.py build
$ sudo python setup.py install
在python環境下 >>> import MySQLdb
/usr/local/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /usr/local/lib/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg/_mysql.pyc, but /app/MySQL-python-1.2.5 is being added to sys.path
安裝成功 ------------------------------------------------------------------------------------------------------------------------------- 安裝過程中報,error: command 'gcc' failed with exit status 1 用yum install gcc 顯示已經是安裝最新版本 未安裝mysql-devel包 解決方法:yum install mysql-devel 參考地址:http://blog.csdn.net/wklken/article/details/7271019 http://blog.csdn.net/agoago_2009/article/details/9492765

 參考檔案 

http://www.aboutyun.com/thread-19402-1-1.html

http://blog.csdn.net/csulfy/article/details/51833407

http://lxw1234.com/archives/2016/06/681.htm

http://km-moon11.iteye.com/blog/2213527

http://airbnb.io/caravel/installation.html