资讯动态

Apache-Superset详细安装-Apache第一大开源项目

发布时间:2026/8/31 14:17:29 来源:尧图企业网站定制
你只需要按照流程来肯定不会出错我经历的坑全部都在里面centos7安装---superset#wget拉取miniconda3安装包自带python12环境superset官网安装环境需要python12 wget https://repo.anaconda.com/miniconda/Miniconda3-py312_24.1.2-0-Linux-x86_64.sh; #执行bash [roothjx-centos7 ~]# bash Miniconda3-py312_24.1.2-0-Linux-x86_64.sh #加载环境变量 source ~/.bashrc #配置镜像 [atguiguhadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free [atguiguhadoop102 ~]$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main [atguiguhadoop102 ~]$ conda config --set show_channel_urls yes #关闭默认conda环境 [atguiguhadoop102 lib]$ conda config --set auto_activate_base false #安装superset环境python [roothjx-centos7 ~]# conda create --name superset python3.12 #进入环境 [roothjx-centos7 ~]# conda activate superset (superset) [supersethjx-el7-superset ~]$ conda install psycopg2 #退出环境 (superset) [roothjx-centos7 ~]# conda deactivate #安装superset依赖 (superset) [roothjx-centos7 ~]# sudo yum install gcc gcc-c libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel python3-devel #更新setuptools和pip (superset) [roothjx-centos7 ~]# pip install --upgrade setuptools pip -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn #安装依赖由于安装superset编译一直卡住导致需要直接安装包然后在进行安装superset (superset) [supersetcentos4 ~]$ pip install apsw3.43.2.0 -i https://mirrors.aliyun.com/pypi/simple/ --only-binary:all: --trusted-host mirrors.aliyun.com #安装Superset (superset) [roothjx-centos7 ~]# pip install apache-superset -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com设置生产元数据数据库superset只支持Mysql、postgresql具体版本请查看superset官网(superset) [roothjx-centos7 bin]# conda install mysqlclient (superset) [supersethjx-el7-superset ~]$ conda install pymysql (superset) [supersethjx-el7-superset bin]$ conda install -c conda-forge mysql-client (superset) [roothjx-rocky8-Superset superset]# vim /root/miniconda3/envs/superset/lib/python3.12/site-packages/superset/config.py #添加一下内容 SQLALCHEMY_DATABASE_URI mysqlpymysql://superset:superset10.197.165.171:3306/superset?charsetutf8mb4 #Mysql数据库需要操作 create database superset; SET GLOBAL validate_password.check_user_name OFF; -- 设置最低策略级别 SET GLOBAL validate_password.policy 0; -- 设置最短密码长度 SET GLOBAL validate_password.length 4; -- 取消大小写混合要求 SET GLOBAL validate_password.mixed_case_count 0; -- 取消数字要求 SET GLOBAL validate_password.number_count 0; -- 取消特殊字符要求 SET GLOBAL validate_password.special_char_count 0; create user superset% IDENTIFIED WITH mysql_native_password BY superset; grant all on *.* to superset%;初始化Superset数据库(superset) [supersethjx-el7-superset ~]$ mkdir -p ./superset/logs (superset) [supersetcentos4 ~]$ openssl rand -base64 42 6eZBllyXhwb5GKDk9K1CGNwymJY54ViNQgNU6X0n2KfxjCoTBfLnsUi2 cd superset; #增加如下内容 vi ./superset_config.py SECRET_KEY 66eZBllyXhwb5GKDk9K1CGNwymJY54ViNQgNU6X0n2KfxjCoTBfLnsUi2 vi ~/.bashrc export SUPERSET_CONFIG_PATH/home/superset/superset/superset_config.py (superset) [atguiguhadoop102 ~]$ superset db upgrade #如果SECRET_KEY报错执行以下操作 export SUPERSET_SECRET_KEYoh-so-secret; #创建管理员用户 (superset) [atguiguhadoop102 ~]$ export FLASK_APPsuperset (superset) [atguiguhadoop102 ~]$ superset fab create-admin ​ #Superset初始化 (superset) [atguiguhadoop102 ~]$ superset init #安装gunicorn (superset) [roothjx-centos7 ~]# pip install gunicorn -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com #启动Superset (superset) [roothjx-centos7 ~]# gunicorn --workers 5 --timeout 120 --bind 10.197.165.117:8100 --daemon --access-logfile /root/superset/logs/access.log --error-logfile /root/superset/logs/error.log superset.app:create_app() #关闭superset (superset) [roothjx-centos7 superset]# ps -ef | awk /superset/ !/awk/{print $2} | xargs kill -9 #配置汉化包 (superset) [roothjx-centos7 superset]# vim superset_config.py (superset) [roothjx-centos7 superset]# cat superset_config.py SECRET_KEY rqqmcnic5/GsCEgvA982tLwe1s0Yx/JTLoSfVkRR5tr5u9BhBpPHWt/c LANGUAGES { zh: {flag: cn, name: 简体中文}, en: {flag: us, name: English}, } #生效环境变量,重启superset (superset) [roothjx-centos7 superset]# source ~/.bashrc配置superset启停脚本cat ./superset.sh EOF #!/bin/bash ​ superset_status(){ resultps -ef | awk /gunicorn/ !/awk/{print $2} | wc -l if [[ $result -eq 0 ]]; then return 0 else return 1 fi } superset_start(){ source ~/.bashrc superset_status /dev/null 21 if [[ $? -eq 0 ]]; then conda activate superset ; gunicorn --workers 5 --timeout 120 --bind 10.197.165.117:8100 --daemon --access-logfile /home/superset/superset/logs/access.log --error-logfile /home/superset/superset/logs/error.log superset.app:create_app() else echo superset正在运行 fi ​ } ​ superset_stop(){ superset_status /dev/null 21 if [[ $? -eq 0 ]]; then echo superset未在运行 else ps -ef | awk /gunicorn/ !/awk/{print $2} | xargs kill -9 fi } ​ ​ case $1 in start ) echo 启动Superset superset_start ;; stop ) echo 停止Superset superset_stop ;; restart ) echo 重启Superset superset_stop superset_start ;; status ) superset_status /dev/null 21 if [[ $? -eq 0 ]]; then echo superset未在运行 else echo superset正在运行 fi esac EOFsuperset连接oracle数据库#安装依赖 (superset) [roothjx-centos7 ~]# conda install oracledb (superset) [roothjx-centos7 superset]# conda install cx_Oracle #安装oracle install Clinet (superset) [roothjx-centos7 superset]# yum install perl-DBD-Pg perl perl-devel perl-DBI perl-CPAN bzip2 perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker wget https://download.oracle.com/otn_software/linux/instantclient/219000/oracle-instantclient-basic-21.9.0.0.0-1.x86_64.rpm wget https://download.oracle.com/otn_software/linux/instantclient/219000/oracle-instantclient-devel-21.9.0.0.0-1.x86_64.rpm wget https://download.oracle.com/otn_software/linux/instantclient/219000/oracle-instantclient-sqlplus-21.9.0.0.0-1.x86_64.rpm sudo rpm -ivh oracle-instantclient-*.rpm cat /etc/profile EOF export ORACLE_HOME/usr/lib/oracle/21/client64/lib export LD_LIBRARY_PATH$ORACLE_HOME export PATH$PATH:$ORACLE_HOME EOF . /etc/profile #连接信息如下 oraclecx_oracle://sys:oracle10.197.165.184:1521/ORCL?modesysdba

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价