Linux环境下(Centos7.0)安装Superset
Posted "Hello World".
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux环境下(Centos7.0)安装Superset相关的知识,希望对你有一定的参考价值。
Linux环境下[Centos7.0]安装Superset
一、安装Python环境
注意:以下操作最好在root用户下执行
- 切换到指定目录
cd /usr/local/src
- 下载Python安装包
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
- 解压下载好的python包
tar -zxvf Python-3.6.0.tgz
- 进入解压目录
cd Python-3.6.0
- 编译安装包
./configure --prefix=/usr/local/python
make && make install
- 添加环境变量
echo PATH='/usr/local/python/bin/:$PATH' >> /etc/profile
- 刷新配置文件,使其生效
source /etc/profile
- 检查是否安装成功
python3.6
- 修改系统默认的python路径,因为在终端中输入Python命令时默认是指向Python2.7.5
mv /usr/bin/python /usr/bin/python-2.7.5
- 建立新的软连接,指向python3.6.0
ln -s /usr/local/python/bin/python3.6 /usr/bin/python
- 因为yum是依赖python的,所以这里我们修改了默认的python,就要修改yum,让其运行指向旧的版本
vi /usr/bin/yum
将第一行中的“#!/usr/bin/python” 修改为“#!/usr/bin/python-2.7.5”,保存即可
vi /usr/libexec/urlgrabber-ext-down(同上)
打开一个新的终端,通过python命令进入python环境,可以看到已经指向了我们新安装的python3.6.0:
python
二、安装容器和密码验证工具
- 按顺序执行以下命令
yum upgrade python-setuptools
yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel
pip install cryptography
pip install virtualenv
-
新建一个容器空间进行操作
新建一个名为venv的容器空间,同时也会新建在当前目录下新建一个venv的文件夹,请提前切换好工作文件夹
python3 -m venv venv
进入venv的容器环境
. venv/bin/activate
容器环境下安装superset
pip install superset
新建一个名为superset_requirements.txt文本文档,
vi superset_requirements.txt
添加如下内容
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file=requirements.txt setup.py
#
alembic==1.3.2 # via flask-migrate
amqp==2.5.2 # via kombu
apispec[yaml]==1.3.3 # via flask-appbuilder
attrs==19.3.0 # via jsonschema
babel==2.8.0 # via flask-babel
backoff==1.10.0 # via apache-superset (setup.py)
billiard==3.6.3.0 # via celery
bleach==3.1.0 # via apache-superset (setup.py)
celery==4.4.1 # via apache-superset (setup.py)
cffi==1.13.2 # via cryptography
click==7.1.1 # via apache-superset (setup.py), flask, flask-appbuilder
colorama==0.4.3 # via apache-superset (setup.py), flask-appbuilder
contextlib2==0.6.0.post1 # via apache-superset (setup.py)
croniter==0.3.31 # via apache-superset (setup.py)
cryptography==2.8 # via apache-superset (setup.py)
decorator==4.4.1 # via retry
defusedxml==0.6.0 # via python3-openid
flask-appbuilder==2.2.4 # via apache-superset (setup.py)
flask-babel==1.0.0 # via flask-appbuilder
flask-caching==1.8.0 # via apache-superset (setup.py)
flask-compress==1.4.0 # via apache-superset (setup.py)
flask-jwt-extended==3.24.1 # via flask-appbuilder
flask-login==0.4.1 # via flask-appbuilder
flask-migrate==2.5.2 # via apache-superset (setup.py)
flask-openid==1.2.5 # via flask-appbuilder
flask-sqlalchemy==2.4.1 # via flask-appbuilder, flask-migrate
flask-talisman==0.7.0 # via apache-superset (setup.py)
flask-wtf==0.14.2 # via apache-superset (setup.py), flask-appbuilder
flask==1.1.1 # via apache-superset (setup.py), flask-appbuilder, flask-babel, flask-caching, flask-compress, flask-jwt-extended, flask-login, flask-migrate, flask-openid, flask-sqlalchemy, flask-wtf
geographiclib==1.50 # via geopy
geopy==1.20.0 # via apache-superset (setup.py)
gunicorn==20.0.4 # via apache-superset (setup.py)
humanize==0.5.1 # via apache-superset (setup.py)
importlib-metadata==1.4.0 # via jsonschema, kombu
isodate==0.6.0 # via apache-superset (setup.py)
itsdangerous==1.1.0 # via flask
jinja2==2.10.3 # via flask, flask-babel
jsonschema==3.2.0 # via flask-appbuilder
kombu==4.6.8 # via celery
mako==1.1.1 # via alembic
markdown==3.1.1 # via apache-superset (setup.py)
markupsafe==1.1.1 # via jinja2, mako
marshmallow-enum==1.5.1 # via flask-appbuilder
marshmallow-sqlalchemy==0.21.0 # via flask-appbuilder
marshmallow==2.19.5 # via flask-appbuilder, marshmallow-enum, marshmallow-sqlalchemy
more-itertools==8.1.0 # via zipp
msgpack==0.6.2 # via apache-superset (setup.py)
numpy==1.18.1 # via pandas, pyarrow
pandas==0.25.3 # via apache-superset (setup.py)
parsedatetime==2.5 # via apache-superset (setup.py)
pathlib2==2.3.5 # via apache-superset (setup.py)
polyline==1.4.0 # via apache-superset (setup.py)
prison==0.1.2 # via flask-appbuilder
py==1.8.1 # via retry
pyarrow==0.16.0 # via apache-superset (setup.py)
pycparser==2.19 # via cffi
pyjwt==1.7.1 # via flask-appbuilder, flask-jwt-extended
pyrsistent==0.15.7 # via jsonschema
python-dateutil==2.8.1 # via alembic, apache-superset (setup.py), croniter, flask-appbuilder, pandas
python-dotenv==0.10.5 # via apache-superset (setup.py)
python-editor==1.0.4 # via alembic
python-geohash==0.8.5 # via apache-superset (setup.py)
python3-openid==3.1.0 # via flask-openid
pytz==2019.3 # via babel, celery, flask-babel, pandas
pyyaml==5.3 # via apache-superset (setup.py), apispec
retry==0.9.2 # via apache-superset (setup.py)
selenium==3.141.0 # via apache-superset (setup.py)
simplejson==3.17.0 # via apache-superset (setup.py)
six==1.14.0 # via bleach, cryptography, flask-jwt-extended, flask-talisman, isodate, jsonschema, pathlib2, polyline, prison, pyarrow, pyrsistent, python-dateutil, sqlalchemy-utils, wtforms-json
sqlalchemy-utils==0.36.1 # via apache-superset (setup.py), flask-appbuilder
sqlalchemy==1.3.12 # via alembic, apache-superset (setup.py), flask-sqlalchemy, marshmallow-sqlalchemy, sqlalchemy-utils
sqlparse==0.3.0 # via apache-superset (setup.py)
urllib3==1.25.8 # via selenium
vine==1.3.0 # via amqp, celery
webencodings==0.5.1 # via bleach
werkzeug==0.16.0 # via flask, flask-jwt-extended
wtforms-json==0.3.3 # via apache-superset (setup.py)
wtforms==2.2.1 # via flask-wtf, wtforms-json
zipp==2.0.0 # via importlib-metadata
# The following packages are considered to be unsafe in a requirements file:
# setuptools
顺序执行以下命令
pip install --upgrade pip
-- 安装依赖包
pip install -r superset_requirements.txt
-- 初始化db环境
superset db upgrade
--账户设定
export FLASK_APP=superset
--创建账户按提示输入账密就好
flask fab create-admin
--下载样例数据,可不执行
superset load_examples
--superset环境初始化
superset init
启动superset
gunicorn --workers 5 --timeout 120 --bind 服务器ip:8787 --daemon "superset.app:create_app()"
web端访问
服务器ip:8787
如:192.xxx.xxx.xx:8787
输入设置好的账号和密码,即可进入superset主页面
示例:
停止superset
ps -ef | awk '/gunicorn/ && !/awk/{print $2}' | xargs kill -9
三、参考链接:
https://www.jianshu.com/p/7392afceeefc
注意:
- 启动superset时,最好以root用户进入容器环境,然后再启动,用其他账户启动后,可能需要superset主页面缺少组件等问题;
- 中途操作会遇到不同的问题,一般都是缺少依赖包,按照报错日志安装相应的依赖包即可。
以上是关于Linux环境下(Centos7.0)安装Superset的主要内容,如果未能解决你的问题,请参考以下文章
Linux(centOS7.0)虚拟机环境下安装JDK1.8
[运维-安全]CentOS7.0环境下安装kangle和easypanel