Update, Upgrade and install Dependancies

apt-get update
apt-get -y upgrade
apt-get -y install build-essential libssl-dev libffi-dev python3-dev python3-pip libsasl2-dev libldap2-dev default-libmysqlclient-dev libpq-dev python-is-python3

Install Superset set with pip on Ubuntu 20.04 while version locking a few packages

pip install --upgrade pip
pip install --upgrade pip --no-warn-script-location
pip install werkzeug==2.0.3 --no-warn-script-location
pip install flask==2.1.3 --no-warn-script-location
pip install wtforms==2.3.0 --no-warn-script-location
pip install --upgrade pyopenssl --no-warn-script-location
pip install psycopg2-binary pillow gunicorn gevent --no-warn-script-location

pip install apache-superset --no-warn-script-location

Configuring Superset and create a Superset user

sudo echo -e 'export FLASK_APP=superset' >> /etc/profile.d/superset.sh
  
export FLASK_APP=superset
FLASK_APP=superset /home/ubuntu/.local/bin/superset db upgrade

FLASK_APP=superset /home/ubuntu/.local/bin/superset fab create-admin --username admin --firstname Fname --lastname Sirname --email admin@domain.com --password <PASSWORD>

FLASK_APP=superset /home/ubuntu/.local/bin/superset init

Starting the application

#enable the python virtual environment
source super/bin/active	 
export FLASK_APP=superset
superset init
superset run -p 8088 --with-threads --reload --debugger --host 0.0.0.0

Configuring Apache2 as Proxy with SSL

sudo apt install apache2

Create the following sites in /etc/apache2/sites-available. Please change the 10.0.0.8 to the proper ip or domain.

/etc/apache2/sites-available/wesite.conf

<VirtualHost *:80>
    #ServerName server.domain.com
    #ServerAlias server.doamin.com

    #Redirect permanent / http://10.0.0.8:8088
    Redirect permanent / https://10.0.0.8

</VirtualHost>

/etc/apache2/sites-available/wesite-sll.conf

<VirtualHost *:443>
    #ServerAdmin root@domain.com
    ServerName 10.0.0.8

    #DocumentRoot /var/www
    #ServerAlias fqdn.domain.com

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
    SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
 
    ProxyPass / http://10.0.0.8:8088/
    ProxyPassReverse / http://10.0.0.8:8088/
    ProxyRequests off
    ProxyPreserveHost On
    SSLProxyEngine On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
</VirtualHost>

Create an SSL Certificate

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt

Enable the Apache sites, enable SSL and start the Apache2 service

sudo a2ensite website.conf
sudo a2ensite website-ssl.conf
sudo a2enmod ssl
sudo systemctl restart apache2