apache-superset-1.2 ubuntu20.04编译安装

1,811 阅读1分钟
商业分析的项目
官网地址:https://superset.apache.org/
前端技术:react
后端技术:Python

源码:https://dist.apache.org/repos/dist/release/superset/1.2.0/apache-superset-1.2.0-source.tar.gz

参考资料

安装python3.8

  • python3.8
    • sudo apt-get update
    • sudo apt-get install python@3.8
    • 检查python版本 python --version
    • 如果python不是3.8版本 sudo ln -s /usr/bin/python3.8 /usr/bin/python3

安装node js

  • apt-get install nodejs
  • apt-get install npm
➜  ~ node -v
v12.18.2

➜  ~ npm -v
6.14.8

➜  ~ python3 --version
Python 3.8.10
➜  ~ 

准备工作(按顺序进行)

  • sudo apt-get install build-essential libssl-dev libffi-dev python3.8-dev python3-pip libsasl2-dev libldap2-dev

创建superset运行虚拟机目录

  • mkdir -p /home/hello/vms/superset
  • cd /home/hello/vms/superset
  • 下载apache-superset-1.2.0-source.tar.gz到目录/home/hello/vms/superset
  • sudo tar -zxvf apache-superset-1.2.0-source.tar.gz -C . // 在当前目录下解压
  • sudo chmod -R 777 apache-superset-1.2.0rc2 // 必须给权限
  • cd /home/hello/vms/superset/apache-superset-1.2.0rc2 // 切换到目录
  • 拷贝依赖文件txt
    • cp requirements/base.txt .
    • cp requirements/development.txt .
  • python3 -m venv superset-vms //创建虚拟机目录
  • source superset-vms/bin/activate //激活

编译后端资源

  • cd /home/hello/vms/superset/apache-superset-1.2.0rc2
  • pip install -r development.txt
  • pip install -e .
  • export FLASK_APP=superset //指定环境变量
  • pip install flask //安装python框架flask
  • flask fab create-admin //创建web登录账号

初始化db

  • cd /home/hello/vms/superset/apache-superset-1.2.0rc2
  • superset db upgrade
  • superset init
  • superset load_examples //加载数据库测试资源

编译前端资源

  • cd /home/hello/vms/superset/apache-superset-1.2.0rc2/superset-frontend
  • npm install -d
  • npm run build

启动

  • 服务端启动
    • cd /home/hello/vms/superset/apache-superset-1.2.0rc2
    • superset run -h 0.0.0.0 -p 8088
  • node启动
    • cd /home/hello/vms/superset/apache-superset-1.2.0rc2/superset-frontend //新开窗口
    • npm run dev