CentOS 7 ready Superset environment

Installation anaconda and superset

Download software anaconda:
https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh

Reference Superset official document:
https://superset.apache.org/

# 执行安装
sh Anaconda3-2019.10-Linux-x86_64.sh
# 然后再这里同意协议,重新指定安装路径
/opt/anaconda3


# 给当前用户添加必要的环境变量
vi ~/.bash_profile
export CONDA_HOME="/opt/anaconda3"
export PATH=$CONDA_HOME/bin:$PATH


# 安装依赖包
yum install gcc gcc-c++ -y

# 创建虚拟机环境
conda create -n superset python=3.6

# 激活环境,安装superset
conda activate superset
pip install --upgrade setuptools pip
pip install superset

# 创建用户(old command):这里我们使用默认的 admin/admin
fabmanager create-admin --app superset
# 创建用户(new command):
flask fab create-admin

superset db upgrade
superset load_examples
superset init

# 默认汉化
/opt/anaconda3/envs/superset/lib/python3.6/site-packages/superset/config.py
BABEL_DEFAULT_LOCALE = "zh"


# 启动
superset run -p 5000 --with-threads --reload --debugger --host=0.0.0.0

Use a proxy

pip install pysocks # 如果让 anaconda 环境使用,需要先安装这个包。
set http_proxy=socks5://127.0.0.1:8484
set https_proxy=socks5://127.0.0.1:8484

Adding a Data Source

# 如下安装 MySQL 驱动包
pip install mysqlclient
mysql+mysqldb://root:[email protected]/database_ename

# 如下安装 postgresql 驱动包
pip install psycopg2
postgresql+psycopg2://postgres:[email protected]/database_ename
  • Find this location on the page, add a data source.
  • According to the above tips to add a database connection, and then click on the test link.
  • And then add the table to find a place inside the menu, add the following table.

Q&A

  • When installed on 10 of Windows, edit the required
    visualcppbuildtools_full.exeenvironment.
  • When installed on 10 of Windows, compiled and installed when the problem will be long path appears.
    Reference Windows common configuration - enable long path .md
  • Note: In Windows 10, need to switch to the installation path Run
    c:\ProgramData\Anaconda3\envs\superset\Lib\site-packages\superset\bin>python superset db upgrade
  • Note: Most of tutorials on the Internet say that you have added the database, you can preview in the bottom of the table information, I have not seen. Here I use postgresql, adding attention to the selection table when Schema is public .

Guess you like

Origin www.cnblogs.com/duchaoqun/p/11982440.html