Apache Superset是一个开源的、现代的、轻量级BI分析工具,能够对接多种数据源、拥有丰富的图表展示形式、支持自定义仪表盘,且拥有友好的用户界面,十分易用。
在学习数仓项目的时候,按照教程安装Superset反复重复多次都没能成狗,最后稍微修改之后得以成功安装,现记录下安装过程
安装Miniconda
下载Miniconda
下载地址:https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
安装Miniconda
执行以下命令
bash Miniconda3-latest-Linux-x86_64.sh
在安装的过程中可以指定安装路径
如果出现以下字段,则安装成功
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cMe7fuKC-1666156636149)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019124040338.png)]](https://img-blog.csdnimg.cn/9ce51d4817e64ace86b45a37cccf9618.png)
加载环境变量配置文件
source ~/.bashrc
取消激活base环境
安装完成之后,每次打开终端都会激活默认的base环境,通过以下命令取消激活
conda config --set auto_activate_base false
创建Python3.6环境
配置国内镜像
(base) [jx@hadoop102 software]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
(base) [jx@hadoop102 software]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
(base) [jx@hadoop102 software]$ conda config --set show_channel_urls yes
创建Python3.6环境
(base) [jx@hadoop102 software]$ conda create --name superset python=3.6
执行完毕
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RoVGuf7u-1666156636151)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019125011683.png)]](https://img-blog.csdnimg.cn/e5bcc83a517f4fbeb72362b5f3879a9b.png)
激活superset环境
(base) [jx@hadoop102 software]$ conda activate superset
效果如下
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-u1gLVjhJ-1666156636152)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019125115953.png)]](https://img-blog.csdnimg.cn/2924055d8a2648ae90fd41734af2b354.png)
使用该命令可以查看python版本
(superset) [jx@hadoop102 software]$ python --version

退出该环境可以执行如下命令
(superset) [jx@hadoop102 software]$ conda deactivate
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Fcqc6p35-1666156636153)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019125339081.png)]](https://img-blog.csdnimg.cn/4d351521285044ffac6ca3f9b344455b.png)
Superset部署
以下所有的操作,都要在superset的环境下进行
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qa73SvDv-1666156636154)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019125512358.png)]](https://img-blog.csdnimg.cn/a0389c435b0947128a7def4cb6c82d7c.png)
安装依赖
(superset) [jx@hadoop102 software]$ sudo yum install -y gcc gcc-c++ libffi-devel python-devel python-pip python-wheel python-setuptools openssl-devel cyrus-sasl-devel openldap-devel
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-TQhfQFFj-1666156636155)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019125705661.png)]](https://img-blog.csdnimg.cn/7608b7d76287495ba3ba8d26e25f1d8f.png)
安装Superset
安装setuptools和pip
(superset) [jx@hadoop102 software]$ pip install --upgrade setuptools pip -i https://pypi.douban.com/simple/
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NXrsf0Fe-1666156636155)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019125900729.png)]](https://img-blog.csdnimg.cn/ac0f531f508b44da96a440ef7eafb2c1.png)
安装Superset
(superset) [jx@hadoop102 software]$ pip install apache-superset -i https://pypi.douban.com/simple/
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-b1453QZj-1666156636156)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019130204540.png)]](https://img-blog.csdnimg.cn/13f6684a0373408788a7a50b32288297.png)
然后执行以下命令(以下两个命令是因为原教程安装错误而自己修改的,包括上面的Python3.6环境)
(superset) [jx@hadoop102 software]$ pip install sqlalchemy==1.3.24
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9u8gw615-1666156636157)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019130328950.png)]](https://img-blog.csdnimg.cn/9717c5ae219d4d6599db76f8f85f5bf5.png)
(superset) [jx@hadoop102 software]$ pip install dataclasses
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-K7y1CugQ-1666156636157)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019130426317.png)]](https://img-blog.csdnimg.cn/fbc13ef4d8b54883bd55be2e0bf60b5d.png)
初始化Superset数据库
(superset) [jx@hadoop102 software]$ superset db upgrade
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-N20d3enq-1666156636158)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019130715656.png)]](https://img-blog.csdnimg.cn/82543fdc5bbe47349de83d2bfa184f4f.png)
创建管理员用户
(superset) [jx@hadoop102 software]$ export FLASK_APP=superset
(superset) [jx@hadoop102 software]$ superset fab create-admin
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-42udViLd-1666156636159)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019130900384.png)]](https://img-blog.csdnimg.cn/5dcf3873545c42dabce92fb659b5518a.png)
以上自行配置即可
Superset初始化
(superset) [jx@hadoop102 software]$ superset init
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zWwnB7u0-1666156636159)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019130956195.png)]](https://img-blog.csdnimg.cn/8e76e3069f344ded99c93c9c09100cf0.png)
启动Superset
安装gunicorn
(superset) [jx@hadoop102 software]$ pip install gunicorn -i https://pypi.douban.com/simple/
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-0MQ0Luxn-1666156636160)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019131052548.png)]](https://img-blog.csdnimg.cn/803b15ff76a14654b92a6b181a46b478.png)
启动Superset
(superset) [jx@hadoop102 software]$ gunicorn --workers 5 --timeout 120 --bind hadoop102:8787 "superset.app:create_app()" --daemon
登录Superset
访问 主机地址+8787 即可
例如我的
http://hadoop102:8787/
![[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-DkargmRK-1666156636160)(C:\Users\Lenovo\AppData\Roaming\Typora\typora-user-images\image-20221019131356123.png)]](https://img-blog.csdnimg.cn/1edb3ea9b1844c3790f53f2f99121226.png)
使用自己创建的管理员账号登录即可

停止superset
(superset) [jx@hadoop102 software]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
ng" alt=“image-20221019131448499” style=“zoom:80%;” />
停止superset
(superset) [jx@hadoop102 software]$ ps -ef | awk '/superset/ && !/awk/{print $2}' | xargs kill -9
版权归原作者 健鑫. 所有, 如有侵权,请联系我们删除。