Supperset (python 2.7.12 + MySQL) record

Source: Internet
Author: User
Tags md5 openssl sqlite sqlite database virtual environment

Online to see superset, more interested in the virtual machine on a ride, record the operation process.

Version Info: CentOS 6.6 + python 2.7.12 + mysql 5.1.73 + setuptools 36.5.0 + pip-9.0.1

1, install Virtual machine Operation CentOS6.6 system environment, process slightly, run the following script (replace Yum source, upgrade python, install Python setuptools, PIP)

#!/bin/bash##################################################################################### #基础设置: # Enable 163yum Source # Upgrade python# ##################################################################################### #v_down_tools =~/down_loadsYum-YGCC GCC-c++ MakeCMake OpenSSL openssl-devel zlib zlib-devel[[! -D ${v_down_tools}] &&mkdir-p ${v_down_tools}################################## #启用163yum源 ##################################### #yum_ upgrade_163 () {CD ${v_down_tools}MV/etc/Yum. repos.d/centos-base.repo/etc/Yum. repos.d/centos-Base.repo.backup # #CentOS7#http://Mirrors.163.com/.help/centos7-base-163.repo# #CentOS6#http://Mirrors.163.com/.help/centos6-base-163.repo# #CentOS5#http://Mirrors.163.com/.help/centos5-base-163.repo    wget-N http://Mirrors.163.com/.help/centos6-base-163.repo        MVcentos6-base-163. repo/etc/Yum. repos.d/centos-Base.repoYum Clean AllYummakecache}################################# #升级Python ########################################## #python_ Upgrade () {# Install Python package CD ${v_down_tools}wget-N https://Www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz    Tar-XF python-2.7. -.Tar. XZif[-D python-2.7. - ]     ThenCD Python-2.7. -        ./configure--prefix=/usr/local/python-2.7. -         Make&& Make Install        MV/usr/bin/python/usr/bin/Python_backup #LN-s/usr/local/python-2.7. -/usr/local/pythonLN-s/usr/local/python-2.7. -/bin/python/usr/bin/python2.7        LN-s/usr/local/python-2.7. -/bin/python/usr/bin/pythonLN-s/usr/local/python-2.7. -/lib/python2.7/usr/lib/python2.7        LN-s/usr/local/python-2.7. -/lib/python2.7/usr/lib/pythonLN-s/usr/local/python-2.7. -/lib/python2.7/usr/lib64/python2.7        LN-s/usr/local/python-2.7. -/lib/python2.7/usr/lib64/pythonfi# #设置yum, notice that the SED delimiter is used here.|sed-I."s|#!/usr/bin/python|#!/usr/bin/python2.6|g"/usr/bin/Yum# #添加环境变量Echo 'Export python_home=/usr/local/python-2.7.14'>>/etc/ ProfileEcho 'export path= $PATH: $PYTHON _home/bin'>>/etc/Profile Source/etc/profile}python_setuptools_pip{CD ${v_down_tools} # #安装setuptools, note install the Setuptools before you install PIPwgetHttps//pypi.python.org/packages/a4/c8/9a7a47f683d54d83f648d37c3e180317f80dc126a304c45dc6663246233a/ SETUPTOOLS-36.5.0.ZIP#MD5=704F500DD55F4BD0BE905444F3BA892C    Unzipsetuptools-36.5.0.ZipCD Setuptools-36.5.0#python setup.py--Help python setup.py build python setup.pyInstallCD ${v_down_tools} # #安装pipwgetHttps//pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/ PIP-9.0.1.TAR.GZ#MD5=35F01DA33009719497F01A4BA69D63C9    Tar-XF pip-9.0.1.Tar. GZ CD pip-9.0.1#python setup.py-h python setup.py build python setup.pyInstall# #升级 #pipInstall--upgrade Setuptools Pip}main () {yum_upgrade_163 Python_upgrade python_setuptools_pip}main
View Code

Note: Python setuptools and Pip are obtained from here: Pypi-the Python package Index:python package Index Https://pypi.python.org/pypi

Here you choose the latest version, the script is finished, the normal situation has been installed PIP, you can execute the command to see if the installation is successful.

2, install, set up MySQL

(1) Installation

# Yum  Install mysql-server mysql-client mysql-devel    # #一定要安装mysql-devel, otherwise installation Mysql-python will error

(2) Start and initialize the service

# service mysqld start#/usr/bin/mysql_secure_installation    #设置用户, password, etc., create SUPERSETDB database

The specific process can be carried out according to the prompts.

3. Install and use VIRTUALENV to deploy superset engineering

Installenvenv/bin/install  superset      Install Mysql-python  #安装驱动

Setting the connection parameters for Supperset

env/lib/python2. 7/site-packages/superset_config.py

The contents are as follows:

#---------------------------------------------------------# Superset Specific config#---------------------------------------------------------Row_limit= thesuperset_workers=4Superset_webserver_port=8088#--------------------------------------------------------- #---------------------------------------------------------# Flask App Builder configuration#---------------------------------------------------------# Your App secret Keysecret_key='[email protected]!#[email protected]'# The SQLAlchemy connectionstringto yourdatabase backend# This connection defines the path to thedatabase that stores your# superset metadata (slices, Connections,tables, dashboards, ...). # Note that the connection information toconnect to the datasources# your want to explore is managed Directlyin the Web UI # Sqlalchemy_database_uri='Mysql://dbuser:[email Protected]:3306/spdbname?charset=utf8'Sqlalchemy_database_uri='Mysql://root:[email Protected]:3306/supersetdb?charset=utf8'# Flask-WTF Flag forcsrfcsrf_enabled=True # Set This API key to enable Mapboxvisualizationsmapbox_api_key="'
View Code

Then, execute the following command sequentially

# Fabmanager Create-admin--app Superset # Create an Admin user (you will be prompted to set the user name, last name, and last name before setting the password) # superset DB Upgrade                   # Initialize database # sup Erset load_examples                # Loading Sample Data # superset init                         8088 &    #后台启动

Open the browser, access the configured address, OK, one of the following pages:

Add: If you use the default SQLite database

    # #先安装sqlite, reinstall Pysqlite    yum install SQLite sqlite-devel    # #安装pysqlite (Use Pysqlite by default    )wget https://pypi.python.org/packages/42/02/ 981b6703e3c83c5b25a829c6e77aad059f9481b0bbacb47e6e8ca12bd731/pysqlite-2.8.3.tar.gz#md5= 033F17B8644577715AEE55E8832AC9FC    tar -xf pysqlite-2.8.  3. Tar . GZ    cd Pysqlite-2.8. 3      -H
Python setup.py Build
Python setup.py Install

Reference:

Use of SQLite and Pysqlite-101010-Blog Park http://www.cnblogs.com/fortwo/archive/2013/04/22/3035691.html (using the SQLite database by default, If you use SQLite for reference)

Python's virtual environment virtualenv_ Wang Zhi _ Sina Blog http://blog.sina.com.cn/s/blog_4ddef8f80101eu0w.html

Install Superset-zhmg23 http://zhmgz.lofter.com/post/90909_e745201 under CentOS

Supperset (python 2.7.12 + MySQL) record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.