环境安装(软件安装到/software下) 1 2 dnf install make gcc gcc-c++ libffi-devel python3-devel python3-pip python3-wheel openssl-devel cyrus-sasl-devel openldap-devel mysql-devel bzip2-devel sqlite-devel xz-devel python3 --version
安装python3.8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 mkdir /softwarecd /softwarewget https://registry.npmmirror.com/-/binary/python/3.8.6/Python-3.8.6.tar.xz tar -xvf Python-3.8.6.tar.xz mkdir pythoncd Python-3.8.6./configure --prefix=/software/python make&&make install rm -rf /usr/bin/python3 ln -s /software/python/bin/python3 /usr/bin/python3 rm -rf /usr/bin/pip3 ln -s /software/python/bin/pip3 /usr/bin/pip ln -s /software/python/bin/pip3 /usr/bin/pip3 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
mysql安装(可以不使用mysql) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 dnf install mysql-server systemctl start mysqld.service systemctl enable mysqld.service systemctl disable mysqld.service mysql_secure_installation * 为root用户设置密码; * 删除匿名账号; * 取消root用户远程登录; * 删除test 库和对test 库的访问权限; * 刷新授权表使修改生效。 mysql -u root -p CREATE DATABASE IF NOT EXISTS superset DEFAULT CHARSET utf8 COLLATE utf8_general_ci; use mysql; update user set host = '%' where user = 'root' ; flush privileges;
安装nodejs16(如果不修改前端代码可以不安装) 1 2 3 4 5 6 7 cd /softwarewget https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz tar -xvf node-v16.14.0-linux-x64.tar.xz mkdir nodemv node-v16.14.0-linux-x64/* node/*ln -s /software/node/bin/node /usr/bin/node ln -s /software/node/bin/npm /usr/bin/npm
项目编译 项目克隆 注意:如果使用windows的git clone,需要设置换行符不转换git config --global core.autocrlf false
1 2 3 4 5 6 cd /softwaregit clone https://github.com/hsiangleev/superset.git git fetch origin my_drilldown git checkout -b my_drilldown origin/my_drilldown git pull origin my_drilldown
编译前端(如果不修改前端代码可以省略这一步) 1 2 3 4 cd /software/superset/superset-frontendnpm ci --registry=https://registry.npmmirror.com npm run build
修改配置项(superset/config.py)
vim /software/superset/superset/config.py
176行mysql连接字符串修改为自己的SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:password@localhost/superset'
589行缓存文件目录修改PATH = os.path.join('/web/superset/cache')
如果需要启用redis缓存,则修改为
1 2 3 4 5 6 7 8 9 10 11 12 CACHE_CONFIG: CacheConfig = { "CACHE_TYPE" : "redis" , 'CACHE_DEFAULT_TIMEOUT' : 60 * 60 * 24 , 'CACHE_REDIS_URL' : 'redis://:password@localhost:6379/2' , 'CACHE_KEY_PREFIX' : 'SUPERSET_DATA' } TABLE_NAMES_CACHE_CONFIG: CacheConfig = { "CACHE_TYPE" : "redis" , 'CACHE_DEFAULT_TIMEOUT' : 60 * 60 * 24 , 'CACHE_REDIS_URL' : 'redis://:password@localhost:6379/2' , 'CACHE_KEY_PREFIX' : 'SUPERSET_DATA' }
启动后端 1 2 3 4 5 6 7 8 9 10 11 12 13 cd /softwarepython3 -m venv virtual source /software/virtual/bin/activate deactivate cd /software/supersetpip install -r requirements/testing.txt pip install -e . pip install pymssql pip install pymysql superset db upgrade superset fab create-admin superset init FLASK_ENV=development superset run -h 0.0.0.0 -p 8088 --with-threads --reload --debugger
访问 1 2 3 firewall-cmd --zone=public --add-port=8088/tcp --permanent firewall-cmd --reload
添加数据库