静态IP设置
# 修改网卡配置文件
vim /etc/sysconfig/network-scripts/ifcfg-ens33
# 修改文件内容
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.18.130
NETMASK=255.255.255.0
GATEWAY=192.168.18.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=2c2371f1-ef29-4514-a568-c4904bd11130
DEVICE=ens33
ONBOOT=true
DNS1=114.114.114.114
# 重启网络
systemctl restart network
MySQL 一键安装
cd /usr/local/src
wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz && tar zxf lnmp1.6.tar.gz && cd lnmp1.6 && ./install.sh db
# 开放服务器端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=3306/udp --permanent
# 配置MySQL远程登陆所允许的IP
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.62-log Source distribution
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql
Database changed
mysql> update user set host = '%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
Miniconda3
# 安装Miniconda
cd /usr/local/src
sudo wget https://repo.anaconda.com/miniconda/Miniconda3-py311_23.11.0-2-Linux-x86_64.sh
bash Miniconda3-py311_23.11.0-2-Linux-x86_64.sh
# 重新加载当前用户环境变量
source ~/.bashrc
# 禁止激活base环境
conda config --set auto_activate_base false
创建Python36环境
# 配置国内源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --set show_channel_urls yes
# 创建Python311环境superset
conda create --name superset python=3.9
# 查看最终环境
(base) [root@localhost src]$ conda info --envs
# conda environments:
#
base * /usr/local/miniconda3
superset /usr/local/miniconda3/envs/superset
# 进入Conda环境
conda activate superset
# 退出Conda环境
conda deactivate
部署SuperSet
sudo yum install -y python-setuptools gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel
conda activate superset
pip3 install --upgrade setuptools pip -i https://pypi.douban.com/simple/
pip3 install apache-superset==3.0.2 -i https://pypi.douban.com/simple/
pip3 install sqlalchemy==1.4.51 -i https://pypi.douban.com/simple/
pip3 install dataclasses==0.6 -i https://pypi.douban.com/simple/
pip3 install pillow==10.2.0 -i https://pypi.douban.com/simple/
# 配置SuperSet元数据库为MySQL
# 执行源数据库建表语句
CREATE DATABASE superset DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
# 配置元数据库远程访问地址
vim /usr/local/miniconda3/envs/superset/lib/python3.9/site-packages/superset/config.py
SQLALCHEMY_DATABASE_URI = 'mysql://root:root@192.168.18.130:3306/superset?charset=utf8'
# 配置数据库连接驱动
conda activate superset
conda install mysqlclient
# 初始化数据库
openssl rand -base64 42
export SUPERSET_SECRET_KEY='lAFneOftiEtQVr73zoQRQilifUMV50tjmB5h2ur0hzS+3Vqm6fD5+n+L'
export FLASK_APP=superset
superset db upgrade
# 创建超管用户
export FLASK_APP=superset
flask fab create-admin
# 初始化 superset init
superset init
# 安装启动管理工具
pip3 install gunicorn -i https://pypi.douban.com/simple/
# 设置弱鉴权避免登录回
vim /usr/local/miniconda3/envs/superset/lib/python3.9/site-packages/superset/config.py
TALISMAN_ENABLED = utils.cast_to_boolean(os.environ.get("TALISMAN_ENABLED", False))
WTF_CSRF_ENABLED = False
# 启动
conda activate superset
export FLASK_APP=superset
export SUPERSET_SECRET_KEY='lAFneOftiEtQVr73zoQRQilifUMV50tjmB5h2ur0hzS+3Vqm6fD5+n+L'
gunicorn --workers 5 --timeout 120 --bind 192.168.18.130:8787 "superset.app:create_app()"
--daemon
# 重置超管账户
cd ~/.superset/
rm -f superset.db
SuperSet配置MySQL连接
conda activate superset
conda install mysqlclient
ADDITIONAL PARAMETERS
charset=UTF8
SuperSet设置中文
vim /usr/local/miniconda3/envs/superset/lib/python3.9/site-packages/superset/config.py
BABEL_DEFAULT_LOCALE = "zh"