markdown 在Ubuntu VM上安装Superset - Notes

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 在Ubuntu VM上安装Superset - Notes相关的知识,希望对你有一定的参考价值。

# Setup Ubuntu
```
$ sudo apt update
$ sudo apt upgrade
$ sudo apt install build-essential libssl-dev libffi-dev python-dev python3-dev python-pip libsasl2-dev libldap2-dev python3-pip python3-venv curl default-libmysqlclient-dev freetds-dev freetds-bin libldap2-dev libpq-dev
$ sudo apt install python3-venv
```

# Setup Virtualenv
```
$ python3 -m venv venv
$ . venv/bin/activate
(venv) $ pip install --upgrade setuptools pip
(venv) $ pip install -r requirements.txt -U
(venv) $ vim superset_config.py
(venv) $ vim .profile # add export SUPERSET_CONFIG_PATH=/home/superset
(venv) $ cp superset.db .superset/ # load existing configurations
(venv) $ superset db upgrade
(venv) $ superset init
```
superset
werkzeug
flask-cors
flask-mail
flask-oauth
flask_oauthlib
impyla
gevent
mysqlclient
pymssql
psycopg2
pyathena 
pyhive 
pyldap 
redis 
sqlalchemy-redshift 
sqlalchemy-clickhouse 
sqlalchemy-redshift
mysqlclient
psycopg2
pymssql
ROW_LIMIT = 5000
SUPERSET_WEBSERVER_PORT = 8888
SECRET_KEY = 'secret_key'
SQLALCHEMY_DATABASE_URI = 'sqlite:////home/superset/.superset/superset.db'
WTF_CSRF_ENABLED = True
WTF_CSRF_EXEMPT_LIST = []
WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365
MAPBOX_API_KEY = ''
SUPERSET_WEBSERVER_TIMEOUT = 60
SQLLAB_TIMEOUT = 60
SQLLAB_ASYNC_TIME_LIMIT_SEC = 60 * 60 * 6
# Install nginx

    $ sudo apt install nginx

# Config systemd

    sudo vim /etc/systemd/system/superset.service

Add this lines:

```
[Unit]
Description=Supserset
After=network.target

[Service]
PermissionsStartOnly=true
PIDFile=/run/superset/superset.pid
User=superset
Group=superset
WorkingDirectory=/home/superset
ExecStartPre=/bin/mkdir /run/superset
ExecStartPre=/bin/chown -R superset:superset /run/superset
ExecStart=/home/superset/venv/bin/gunicorn superset:app \
          --pid /run/superset/superset.pid \
          --bind 0.0.0.0:8888 \
          -w 10 -k gevent --timeout 120 \
          --limit-request-line 0 \
          --limit-request-field_size 0
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
ExecStopPost=/bin/rm -rf /run/superset
PrivateTmp=true

[Install]
WantedBy=multi-user.target
```

Reload systemd configuration

    sudo systemctl daemon-reload

## Configure ngnix proxy_pass

    sudo vim /etc/nginx/sites-enabled/default

Add `proxy_pass ...`

```
...
	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		# try_files $uri $uri/ =404;
		proxy_pass http://0.0.0.0:8888;
	}
...
```

## Superset: start, stop, status

    sudo systemctl start superset.service

    sudo systemctl stop superset.service

    sudo systemctl status superset.service

以上是关于markdown 在Ubuntu VM上安装Superset - Notes的主要内容,如果未能解决你的问题,请参考以下文章

一文搞定通过UTM 在MAC M1 上安装centos/ubuntu VM

markdown 在Ubuntu 18上安装Froxlor

markdown 在Ubuntu上安装Kubernetes集群

markdown 在Windows上安装ubuntu脱机

markdown 在Ubuntu上安装pyenv

markdown 使用Wine在Ubuntu上安装Safari