centos 7 下 安装配置 caravel
时间:2016-11-03 17:13 来源:linux.it.net.cn 作者:IT
安装基础包: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
第二章详细步骤如下:
A.下载:wget http://sourceforge.net/projects/mysql-python/files/latest/download
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
(责任编辑:IT)
安装基础包:yum groupinstall "Development tools"
一、pip安装1. 安装python
需要2.7版本的Python,如果centOS自带的是2.7的则不需安装(centOS7自带了2.7.5) ② 解压 ③ 编译安装 # ./configure --prefix=/usr/local
2. 安装pip
首先
3. 安装caravel
① 获得caravel源码
4. 错误(如果有错误执行下面的)
① cffi yum install openssl
二、nmp安装1. 安装nodejs下载node-v4.5.0.tar.gz(官网)解压
# ./configure --prefix=/usr/local
2. 安装npm
根据网址下载 install.sh (https://npmjs.org/install.sh) 3. 安装express# npm install express -g
4. 安装caravel(源码安装)
## assuming $CARAVEL_HOME as the root of the repo
三、初始化运行创建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
linux环境下安装MySQL-python的两种方式
第一种 简单:yum install MySQL-python 第二种:复杂:需要自己源码编译,依赖包比较多 a. gcc b. setuptools c. python-dev
第二章详细步骤如下:
A.下载:wget http://sourceforge.net/projects/mysql-python/files/latest/download
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 (责任编辑:IT) |