操作系统依赖
yum -y install epel-release
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
yum install -y python-setuptools
yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
一、安装python3.6
二、修改yum配置(yum基于python,python版本更换后需要配置yum)
三、安装postgresql环境
四、superset环境搭建
环境配置
系统:centos7
python:python3.6
数据库:postgresql10
想要搭建一个superset,superset已不再支持python2,在网上各种查资料参考,终于成功,做一下记录,在我的centos7系统上安装运行没有问题
一、安装python3.6
1、安装python3.6所需要的依赖包
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
1
2、到python官网下载python3.6的包(使用wget命令,centos7需要安装wget命令)
yum install wget -y
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
1
2
3
3、解压下载的包
tar zxvf Python-3.6.0.tgz
1
4、安装依赖包
yum install gcc gcc-c++ automake autoconf libtool make
1
5、配置,编译及安装
cd Python-3.6.0
./configure --with-ssl --prefix=/opt/python3
make && make install
1
2
3
6、删除旧的软链接,创建新的软链接到最新的python
rm -rf /usr/bin/python
rm -rf /usr/bin/pip
ln -s /opt/python3/bin/python3.6 /usr/bin/python
ln -s /opt/python3/bin/pip3.6 /usr/bin/pip
1
2
3
4
7、检查
python -V
pip -V
1
2
二、修改yum配置(yum基于python,python版本更换后需要配置yum)
vi /usr/bin/yum
1
将第一行"#!/usr/bin/python" 改为 “#!/usr/bin/python2.7”
vi /usr/libexec/urlgrabber-ext-down
1
将第一行"#!/usr/bin/python" 改为 “#!/usr/bin/python2.7”
三、安装postgresql环境
1、安装postgresql10源
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
1
2、 安装postgresql-devel
yum install -y postgresql-devel
1
四、superset环境搭建
1、安装依赖包
yum install gcc libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel
1
2、更新pip
pip install --upgrade pip
1
3、安装虚拟环境
pip install virtualenv
1
4、创建虚拟环境目录
virtualenv superset-postgresql
1
5、启动虚拟环境
. ./superset-postgresql/bin/activate
1
6、安装postgresql驱动
pip install psycopg2
1
7、安装superset
pip install superset
1
8、修改数据源
vi /opt/superset-postgresql/lib/python3.6/site-packages/superset/config.py
1
找到SQLALCHEMY_DATABASE_URI,进行修改,注释掉sqllite的URI
SQLALCHEMY_DATABASE_URI = ‘postgresql://postgres:[email protected]/ceshi’
9、创建一个管理员用户(在设置密码之前会提示您设置用户名,名字和姓氏)
fabmanager create-admin --app superset
Username [admin]: admin 用户名
User first name [admin]: admin 名字
User last name [user]: admin 姓
Email [[email protected]]: [email protected] 邮箱
Password:
Repeat for confirmation:
1
2
3
4
5
6
7
注意:出现Was unable to import superset Error: cannot import name ‘_maybe_box_datetimelike’
解决办法:
pip uninstall pandas
pip install pandas==0.23.4
出现sqlalchemy.exc.InvalidRequestError: Can’t determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Try adding an explicit ON clause to help resolve the ambiguity
解决办法:
pip uninstall SQLAlchemy
pip install SQLAlchemy==1.2
然后重新运行fabmanager create-admin --app superset
10、初始化数据库
superset db upgrade
1
11、载入案例数据
superset load_examples
1
12、初始化角色和权限
superset init
1
13、启动服务,默认端口号 8088,使用 -p 更改端口号
superset runserver -p 8080
1
14、使用浏览器就能登录使用了
http://192.168.1.3:8080
————————————————
版权声明:本文为CSDN博主「永不变的初心。」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43813336/article/details/94395683