安裝完安裝一些基礎(chǔ)包: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
創(chuàng)新互聯(lián)專(zhuān)業(yè)為企業(yè)提供宿城網(wǎng)站建設(shè)、宿城做網(wǎng)站、宿城網(wǎng)站設(shè)計(jì)、宿城網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、宿城企業(yè)網(wǎng)站模板建站服務(wù),10余年宿城做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
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
添加以下內(nèi)容:
[mysqld]
port = 3306
socket = /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /data/mysql
user = mysql
character_set_server = utf8
配置mysql 啟動(dòng)
cp support-files/mysql.server /etc/init.d/mysql
vim /etc/init.d/mysql
添加以下兩行
basedir=/usr/local/mysql
datadir=/data/mysql
安裝完成啟動(dòng)服務(wù)修改密碼:
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 之后,還需要運(yùn)行這個(gè)命令:
yum install -y yum-utils && yum-config-manager --enable epel
來(lái)啟用 EPEL,這樣才可以運(yùn)行命令:
yum install -y python-pip
來(lái)安裝 pip 工具。最后,建議大家再運(yùn)行命令:
pip install --upgrade pip
3.安裝superset平臺(tái):
依賴(lài)包安裝;
yum upgrade python-setuptools
yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
官網(wǎng)推薦在virtualenv中安裝 supersetpip install virtualenv
創(chuàng)建和激活一個(gè) virtualenv ,創(chuàng)建后會(huì)在當(dāng)前目錄生成一個(gè) supersetenv的目錄virtualenv supersetenv
啟動(dòng) supersetenv,先進(jìn)入創(chuàng)建的virtualenv目錄
cd supersetenv/
source ./bin/activate
更新pip和setuptools:pip install --upgrade setuptools pip
安裝mysqlclient。
將superset的元數(shù)據(jù)存儲(chǔ)改成mysql,就需要這一步。
ROOT權(quán)限下,為了連接mysqlyum install mysql-devel
virtualenv下:pip install mysqlclient
添加superset的配置文件。
在python所在的目錄即PYTHONPATH(如,我這里是/root/supersetenv/bin下),手動(dòng)添加superset的配置文件superset_config.py。內(nèi)容如下:
#-*- coding: utf-8 -*-
#===============superset_config.py開(kāi)始================
#使用python2.7,如果下面三行不加的話(huà),使用中文時(shí)會(huì)出問(wèn)題。
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'
#元數(shù)據(jù)存儲(chǔ)默認(rèn)使用的是sqlite。SQLALCHEMY_DATABASE_URI = 'sqlite:////path/to/superset.db'
#我這里改成mysql
#mysql://用戶(hù)名:密碼@192.168.1.162/數(shù)據(jù)庫(kù)名?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結(jié)束===============
最后,安裝 superset,在安裝之前需要在mysql先創(chuàng)建superset的數(shù)據(jù)庫(kù)
show variables like "%char%";
create database superset
use superset
--這里如果不設(shè)置數(shù)據(jù)庫(kù)為utf8,在后面初始化數(shù)據(jù)庫(kù)時(shí)會(huì)報(bào) Specified key was too long; max key length is 767 bytes 的錯(cuò)誤
alter database superset character set utf8;
安裝superset,最新版本是26.3
pip install superset==0.26.3
pip install "markdown<3.0.0" superset
創(chuàng)建admin用戶(hù)
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
初始化數(shù)據(jù)superset db upgrade
啟動(dòng)supersetsuperset runserver
//或者指定端口
superset runserver -p 8388 &
pip install pymysql