Apache Superset – On-Prem Installation SOP
Apache Superset – On-Prem Installation SOP
Production Deployment (No Docker)
Ubuntu 22.04 / 24.04
PostgreSQL Metadata
Redis Cache
MySQL Enabled
systemd + Gunicorn
1. System Preparation
sudo apt update && sudo apt upgrade -y sudo apt install -y \ build-essential libssl-dev libffi-dev python3-dev python3-venv \ libsasl2-dev libldap2-dev libpq-dev default-libmysqlclient-dev \ redis-server postgresql postgresql-contrib curl git nginx sudo systemctl enable redis-server sudo systemctl start redis-server
2. PostgreSQL Metadata Database
sudo -u postgres psql CREATE DATABASE superset; CREATE USER superset_user WITH PASSWORD 'StrongPassword'; ALTER ROLE superset_user SET client_encoding TO 'utf8'; ALTER ROLE superset_user SET default_transaction_isolation TO 'read committed'; ALTER ROLE superset_user SET timezone TO 'UTC'; GRANT ALL PRIVILEGES ON DATABASE superset TO superset_user; \q
3. Superset OS User
sudo useradd -m -s /bin/bash superset sudo su - superset
4. Python Virtual Environment
python3 -m venv superset-venv source superset-venv/bin/activate pip install --upgrade pip setuptools wheel
5. Install Apache Superset
pip install apache-superset superset version
6. MySQL Driver Installation
sudo apt install -y pkg-config python3-dev default-libmysqlclient-dev
pip install mysqlclient pymysql
python -c "import MySQLdb, pymysql; print('MySQL OK')"
7. Superset Configuration
mkdir -p ~/.superset nano ~/.superset/superset_config.py
SECRET_KEY = "GENERATE_USING_OPENSSL"
SQLALCHEMY_DATABASE_URI = (
"postgresql+psycopg2://superset_user:StrongPassword@localhost:5432/superset"
)
REDIS_HOST = "localhost"
REDIS_PORT = 6379
CACHE_CONFIG = {
"CACHE_TYPE": "RedisCache",
"CACHE_DEFAULT_TIMEOUT": 300,
"CACHE_KEY_PREFIX": "superset_",
"CACHE_REDIS_HOST": REDIS_HOST,
"CACHE_REDIS_PORT": REDIS_PORT,
}
DATA_CACHE_CONFIG = CACHE_CONFIG
8. Initialize Superset
export FLASK_APP=superset superset db upgrade superset fab create-admin superset init
9. Architecture Overview
Browser
→
Nginx
→
Gunicorn
Superset
Superset
↓
PostgreSQL
Metadata
Metadata
Redis
Cache
Cache
MySQL
Datasource
Datasource
10. systemd Service
[Service] User=superset WorkingDirectory=/home/superset Environment="PATH=/home/superset/superset-venv/bin" ExecStart=/home/superset/superset-venv/bin/gunicorn \ --workers 4 --threads 4 --timeout 120 \ --bind 127.0.0.1:8088 "superset.app:create_app()" Restart=always
11. Nginx Reverse Proxy
server {
listen 80;
server_name superset.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:8088;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
12. Final Checklist
- Superset UI accessible
- PostgreSQL metadata DB working
- Redis running
- MySQL visible in database list
- systemd service active
- Nginx proxy working
Comments
Post a Comment