添加系统依赖
yum upgrade python-setuptools
yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
创建虚拟环境
- 为了避免依赖冲突,创建superset的虚拟环境
conda create -n super python=3.8
- 进入虚拟环境
source activate super
- 切换 pip下载源
pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple
- pip 安装相关依赖(有点多,别慌慢慢安装依赖,一般不会有问题,有问题就切换到清华镜像)
pip install flask wtforms_json flask_appbuilder
pip install wtforms_json flask_compress celery flask_migrate flask_talisman flask_caching sqlparse bleach markdown numpy parsedatetime pathlib2 simplejson humanize geohash polyline geopy cryptography backoff msgpack pyarrow contextlib2 croniter retry selenium isodate
pip install pytest-runner
备注:如果pip install pytest-runner安装失败,请使用清华镜像
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pytest-runner
pip install pandas==0.23.4
pip install --upgrade werkzeug==0.16.1
pip install flask-jwt-extended==3.18.1
pip install flask==0.12.5
pip install sqlalchemy==1.2.18
pip install superset==0.28.1
配置Superset
创建管理员用户
fabmanager create-admin --app superset
- 提示:-bash:fabmanager not found fabmanager
仔细核对依赖文件,是否有缺少,然后执行如下命令
安装request
pip install requests -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com/
安装 flask-appbuilder
pip install flask-appbuilder -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com/
- 执行的时候会有这么一行提示,别慌,这是一种新用法接着向后操作即可
fabmanager is going to be deprecated in 2.2.X, you can use the same commands on the improved 'flask fab <command>'
- 接着会让你输入用户名(username)、Fist Name、Last Name、邮箱地址、密码、重复密码。
如果遇到以下错误
Was unable to import superset Error: cannot import name '_maybe_box_datetimelike'
原因是 pandas (在安装 superset 时会做为依赖被安装上)版本太高,需要卸载,再安装低版本的 pandas。
初始化数据库
superset db upgrade
载入测试数据
superset load_examples
初始化角色和权限
superset init
启动服务 端口号 8088,使用 -p 更改端口号
superset runserver
然后在浏览器中打开 http://ip:8088 就可以看到 superset 了
- 如果访问失败,请检查一下防火墙
systemctl status firewalld //防火墙状态
systemctl stop firewalld // 关闭
systemctl start firewalld // 开启
输入签名设置的账号和密码点击登录即可
到此,恭喜你,完成了Superset的安装及基础配置了。
在下一章,我将介绍,Superset的基本使用。