开启辅助访问 切换到窄版

打印 上一主题 下一主题

Linux下开源BI工具Superset的1.0以上版本安装

[复制链接]
作者:丁r 
版块:
嵌入式操作系统 linux 发布时间:2021-3-29 15:10:11
10800
楼主
跳转到指定楼层
| 只看该作者 回帖奖励 |倒序浏览 |阅读模式
操作系统:CentOS Linux release 7.5.1804 (Core)
此教程在前面Linux下通过PIP安装BI工具Superset 基础上安装一个新的Python3.7的环境进行安装Superset1.0.1的版本。
安装Python3.7
由于Superset1.0以上的版本要求Python的环境为3.7或3.8。下面安装3.7的版本作为运行环境。
下载源码包及解压并编译安装
yum install -y xz-devel bzip2-develwget http://www.python.org/ftp/python/3.7.10/Python-3.7.10.tar.xzxz -d Python-3.7.10.tar.xztar -xf Python-3.7.10.tarcd Python-3.7.10./configure --prefix=/usr/local/makemake installmake altinstall创建新的环境并安装之前的版本安装在root用户目录下,现在新建一个新用户superset 存放新安装的Superset1.0.1,并在用户的目录下安装虚拟环境
groupadd supersetuseradd -g superset supersetcd /home/supersetpip3.7 install -i http://pypi.doubanio.com/simple virtualenvpython3.7 -m venv venv. venv/bin/activate/home/superset/venv/bin/python3.7 -m pip install --upgrade pip安装和初始化Superset安装apache-superset
pip install -i http://pypi.doubanio.com/simple sqlalchemy==1.3.23pip install -i http://pypi.doubanio.com/simple apache-superset
会自动安装最新的版本1.0.1
修改数据库连接配置,这里采用数据库:PostgreSQL
vi /home/superset/venv/lib64/python3.7/site-packages/superset/config.py
修改内容如下:
# The SQLAlchemy connection string.# SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(DATA_DIR, "superset.db")# SQLALCHEMY_DATABASE_URI = 'mysql://myapp@localhost/myapp'SQLALCHEMY_DATABASE_URI = 'postgresql://postgres:password@localhost:5432/superset'# Default cache for Superset objectsCACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"}# Cache for datasource metadata and query resultsDATA_CACHE_CONFIG: CacheConfig = {"CACHE_TYPE": "simple"}
进行数据库初始化:
pip install -i http://pypi.doubanio.com/simple psycopg2 Pillowsuperset db upgrade
通过运行以下命令完成安装:
export FLASK_APP=supersetsuperset fab create-admin
修改superset下相关文件的配置路径,修改里面的BASE_URL的值为前面安装设置的值:
vi /home/superset/venv/lib64/python3.7/site-packages/superset/examples/helpers.py
修改video_game_sales.yaml的里面的github相关的地址,
vi /home/superset/venv/lib64/python3.7/site-packages/superset/examples/configs/datasets/examples/video_game_sales.yaml
修改内容为:
#data: http://github.com/apache-superset/examples-data/raw/lowercase_columns_examples/datasets/examples/video_game_sales.csvdata: http://raw.githubusercontent.com/apache-superset/examples-data/lowercase_columns_examples/datasets/examples/video_game_sales.csv
执行加载示例:
superset load_examples
创建默认角色和权限
superset init开放相应的端口,端口取决于您设置的端口
firewall-cmd --zone=public --add-port=8080/tcp --permanentfirewall-cmd --reload
创建注册服务的文件
vi /usr/lib/systemd/system/supersetlast.service
文件内容
[Unit]Description=SupersetAfter=multi-user.target[Service]Type=simpleUser=rootExecStart=/home/superset/venv/bin/python3.7 /home/superset/venv/bin/superset run -p 8080 -h 127.0.0.1 --reload[Install]WantedBy=default.target
注册为系统服务
systemctl enable supersetlast.service
启动服务
systemctl start supersetlast.service
查看服务状态
systemctl status supersetlast.service
查看启动效果:

启动效果

首页效果
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表