Building superset data platform by centos7
After installation, install some basic packages:
Yum-y install perl gd gd-devel libpng libpng-devel libjpeg libjpeg-devel zlib zlib-devel pcre-devel gcc gcc-c++ make cmake autoconf openssl openssl-devel ncurses-devel patch libxml2 libxml2-devel curl-devel openldap openldap-devel libevent libevent-devel bison icu libicu-devel libtool readline-devel net-snmp-devel bzip2-devel freetype-devel vim
1. Install mysql
Useradd-s / sbin/nologin-M mysql tar zxvf mysql-5.5.29.tar.gz cd mysql-5.5.29 cmake. \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql\-DINSTALL_DATADIR=/data/mysql\-DMYSQL_UNIX_ADDR=/tmp/mysql.sock\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DWITH_EXTRA_CHARSETS=complex\-DMYSQL_USER=mysql make & & make install
Configuration after Mysql installation:
Cd / usr/local/mysqlscripts/mysql_install_db-- user=mysql-- basedir=/usr/local/mysql-- datadir=/data/mysql chown-R root. Cp support-files/my-medium.cnf / etc/my.cnf vim / etc/my.cnf adds the following: [mysqld] port = 3306 socket = / tmp/mysql.sock basedir = / usr/local/mysql datadir = / data/mysql user = mysql character_set_server = utf8
Configure mysql startup
Cp support-files/mysql.server / etc/init.d/mysql vim / etc/init.d/mysql add the following two lines of basedir=/usr/local/mysql datadir=/data/mysql
After installation, start the service and change the password:
Service mysql start add soft connection: ln-s / usr/local/mysql/bin/mysql / usr/bin ln-s / usr/local/mysql/bin/mysqladmin / usr/bin initialization password: mysqladmin-uroot password
two。 Install pip
Yum install-y epel-release
After installing EPEL, you also need to run this command:
Yum install-y yum-utils & & yum-config-manager-- enable epel
To enable EPEL so that you can run the command:
Yum install-y python-pip
To install pip tools. Finally, I suggest you run the command again:
Pip install-upgrade pip
3. Install the superset platform:
Dependent package installation
Yum upgrade python-setuptools yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
It is recommended to install superset in virtualenv on the official website
Pip install virtualenv
Create and activate a virtualenv, which will generate a supersetenv directory in the current directory
Virtualenv supersetenv
Start supersetenv and enter the created virtualenv directory first
Cd supersetenv/ source. / bin/activate
Update pip and setuptools:
Pip install-upgrade setuptools pip
Install mysqlclient.
This step is required to change the metadata store of superset to mysql.
Under ROOT permission, in order to connect to mysql
Yum install mysql-devel
Under virtualenv:
Pip install mysqlclient
Add the configuration file for superset.
In the directory where python is located, PYTHONPATH (for example, I am under / root/supersetenv/bin), manually add the configuration file superset_config.py for superset. The contents are as follows:
#-*-coding: utf-8-*-# = superset_config.py start = # use python2.7. If you don't add the following three lines, there will be problems when using Chinese. Import sys # import sys package If not already imported reload (sys) sys.setdefaultencoding ('utf-8') #-# Superset specific config #- -ROW_LIMIT = 5000 SUPERSET_WORKERS = 4 SUPERSET_WEBSERVER_PORT = 8088 #-- # Flask App Builder configuration #- -- # Your App secret key SECRET_KEY ='\ 2\ 1thisismyscretkey\ 1\ 2\ e\ y\ y\ h' # metadata storage uses sqlite by default. SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/superset.db' # I changed it to mysql # mysql:// username: password @ 192.168.1.162 / database name? charset=utf8 SQLALCHEMY_DATABASE_URI =' mysql://datag:yjkdatag@192.168.1.162/superset?charset=utf8' # Flask-WTF flag for CSRF WTF_CSRF_ENABLED = True # Set this API key to enable Mapbox visualizations MAPBOX_API_KEY =''# Chinese BABEL_ DEFAULT_LOCALE='zh' LANGUAGES = {'zh': {' flag': 'cn' 'name':' Chinese'}, 'en': {' flag': 'us',' name': 'English'}} # = superset_config.py end =
Finally, to install superset, you need to create a database of superset in mysql before installation
Show variables like "% char%"; create database superset use superset-if the database is not set to utf8, an error alter database superset character set utf8 of Specified key was too long; max key length is 767 bytes will be reported later when initializing the database
Install superset, the latest version is 26.3
Pip install superset==0.26.3 pip install "markdown