您好,登錄后才能下訂單哦!
安裝完安裝一些基礎包: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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。