SuperSet Liunx安装
1.安装Python
下载Python包 tar -zxvf Python-3.6.2.tgz cd Python-3.6.2/ 开始安装编译 ./configure --prefix=/usr/python3.6 make make install 让centos7 系统默认使用python3.6 cd /usr/bin/ mv python python.bak ln -s /usr/python3.6/bin/python3 /usr/bin/python
让centos7 系统默认使用python3.6 cd /usr/bin/ mv python python.bak ln -s /usr/python3.6/bin/python3 /usr/bin/python [root@python-ex bin]# python Python 3.6.1 (default, May 25 2017, 20:20:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
因为yum使用的是python2,替换python3之后可能导致无法正常工作,继续使用这个python2.7.5因为yum使用python2,因此替换为python3后可能无法正常工作,
继续使用这个python2.7.5因此修改yum配置文件(vim /usr/bin/yum)。 把文件头部的#!/usr/bin/python改成#!/usr/bin/python2.7保存退出即可 如果出现以下错误: File "/usr/libexec/urlgrabber-ext-down", line 28 except OSError, e: ^ SyntaxError: invalid syntax 解决办法是修改 vim /usr/libexec/urlgrabber-ext-down 将/usr/bin/python改为/usr/bin/python2.7。
2.安装插件
sudo yum upgrade python-setuptools
sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
3.安装pip
1、首先检查linux有没有安装python-pip包,直接执行 yum install python-pip 2、没有python-pip包就执行命令 yum -y install epel-release 3、执行成功之后,再次执行yum install python-pip 4、对安装好的pip进行升级 pip install --upgrade pip
4.安装virtualenv
mkdir mypriject
cd myproject
官网推荐在virtualenv安装 superset pip install virtualenv 创建和激活一个 virtualenv : virtualenv venv source venv/bin/activate
想要退出virtualenv,
直接输入: deactivate
5.更新pip和setuptools:
sudo pip install --upgrade setuptools pip # 更新pip和setuptools
sudo pip install superset
bin/添加手动添加superset的配置文件superset_config.py
# ===============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 #默认是8088,改成8388 SUPERSET_WEBSERVER_PORT = 8388 #--------------------------------------------------------- #--------------------------------------------------------- # 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结束================
6.创建用户初始化以及加载样例
fabmanager create-admin --app superset Username [admin]: # login name User first name [admin]: # first name User last name [user]: # lastname Email [admin@fab.org]: # email, must unique Password: Repeat for confirmation: Error: the two entered values do not match Password: #superset Repeat for confirmation: #superset // ... Recognized Database Authentications. superset db upgrade # Load some data to play with superset load_examples # Create default roles and permissions superset init