安装完安装一些基础包: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.安装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
Mysql 安装之后的配置:
cd /usr/local/mysql
scripts/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
添加以下内容:
[mysqld]
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /data/mysql
user = mysql
character_set_server = utf8
配置mysql 启动
cp support-files/mysql.server /etc/init.d/mysql
vim /etc/init.d/mysql
添加以下两行
basedir=/usr/local/mysql
datadir=/data/mysql
安装完成启动服务修改密码:
service mysql start
添加软连接:
ln -s /usr/local/mysql/bin/mysql /usr/bin
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
初始化密码:
mysqladmin -uroot password
2.安装pip
yum install -y epel-release
安装好 EPEL 之后,还需要运行这个命令:
yum install -y yum-utils && yum-config-manager --enable epel
来启用 EPEL,这样才可以运行命令:
yum install -y python-pip
来安装 pip 工具。最后,建议大家再运行命令:
pip install --upgrade pip
3.安装superset平台:
依赖包安装;
yum upgrade python-setuptools
yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
官网推荐在virtualenv中安装 superset pip install virtualenv
创建和激活一个 virtualenv ,创建后会在当前目录生成一个 supersetenv的目录virtualenv supersetenv
启动 supersetenv,先进入创建的virtualenv目录
cd supersetenv/
source ./bin/activate
更新pip和setuptools:pip install --upgrade setuptools pip
安装mysqlclient。
将superset的元数据存储改成mysql,就需要这一步。
ROOT权限下,为了连接mysqlyum install mysql-devel
virtualenv下:pip install mysqlclient
添加superset的配置文件。
在python所在的目录即PYTHONPATH(如,我这里是/root/supersetenv/bin下),手动添加superset的配置文件superset_config.py。内容如下:
#-*- coding: utf-8 -*-
#===============superset_config.py开始================
#使用python2.7,如果下面三行不加的话,使用中文时会出问题。
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'
#元数据存储默认使用的是sqlite。SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/superset.db'
#我这里改成mysql
#mysql://用户名:密码@192.168.1.162/数据库名?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 = ''
#汉化
BABEL_DEFAULT_LOCALE='zh'
LANGUAGES = {
'zh': {'flag': 'cn', 'name': 'Chinese'},
'en': {'flag': 'us', 'name': 'English'}
}
#=============== superset_config.py结束===============
最后,安装 superset,在安装之前需要在mysql先创建superset的数据库
show variables like "%char%";
create database superset
use superset
--这里如果不设置数据库为utf8,在后面初始化数据库时会报 Specified key was too long; max key length is 767 bytes 的错误
alter database superset character set utf8;
安装superset,最新版本是26.3
pip install superset==0.26.3
pip install "markdown<3.0.0" superset
创建admin用户
fabmanager create-admin --app superset
然后需要输入:
Username [admin]: admin
User first name [admin]: admin
User last name [user]: admin
Email [admin@fab.org]: admin@163.com
Password: admin
Repeat for confirmation: admin
初始化数据superset db upgrade
启动supersetsuperset runserver
//或者指定端口
superset runserver -p 8388 &
pip install pymysql
原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/193451.html