superset 详细安装

superset 详细安装(此篇文章为linux安装Superset教程

目录

superset 详细安装(此篇文章为linux安装Superset教程)

1:安装Python3以上的版本

2:下载依赖包

3: 下载sqlite 

4:  上传完成之后解压。

5:编译安装

6:进入安装Python的路径

7:下载Python并解压

8:编译安装包,进入Python目录

9:添加环境变量并刷新

10:检查是否安装成功,进入Python环境

11: 修改系统默认的Python路径, 两个命令

12: 因为yum是依赖python的, 所以这里我们修改了默认的python,就要修改yum,让他运行指向旧的版本 (修改两个文件)

13: 安装容器

14: 新建一个名为venv的容器空间,同时也会新建在当前目录下新建一个venv的文件夹,请提前切换好工作文件夹

15: 进入venv的容器环境

16: 容器环境下安装superset

17: 提示更新

18:以下是重点,最多坑的地方,因为superset的运行依赖很多第三方库代码,所以安装python的依赖包并保证完整性很费事,有人整理了一个文档将这些依赖包进行汇总,下载此文档后,在本地按照文件安装依赖包就好 安装到python3下载环境:/usr/local/src/Python-3.6.0 (也可以提前下载在放进去)

19: 安装依赖包

20:  初始化DB环境 

21: 账户设定

22: 创建账户按提示输入账密就好

23: 下载样例数据,可不执行

24: 环境初始化

26:启动 这里面我指定了端口和IP,分别是-p 和 -h 参数,建议指定成自己的服务器IP和某个端口,网页访问的时候,**还需要将这个端口对外开放,不然你本地登录网页访问会无法成功**


1:安装Python3以上的版本

[root@slave2 ~]#   yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel

superset 详细安装_第1张图片

2:下载依赖包

[root@slave2 ~]#  yum install wget

superset 详细安装_第2张图片

3: 下载sqlite 

wget http://www.sqlite.org/2018/sqlite-autoconf-3230100.tar.gz

可以选择wget再服务器上直接下载,也可以提前下载好了放进去,放在root用户目录就行。下载链接: 百度网盘 请输入提取码 提取码: kw4f

superset 详细安装_第3张图片

4:  上传完成之后解压。


tar -xzf sqlite-autoconf-3230100.tar.gz
进入解压路径
cd /root/sqlite-autoconf-3230100

5:编译安装

./configure

superset 详细安装_第4张图片

之后再执行三个命令

make && make instal

yum install bzip2-devel


yum install python-setuptools

superset 详细安装_第5张图片

superset 详细安装_第6张图片


6:进入安装Python的路径

[root@slave2 sqlite-autoconf-3230100]# cd /usr/local/src
[root@slave2 src]# 
[root@slave2 src]# pwd
/usr/local/src

7:下载Python并解压

[root@slave2 src]#  wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

[root@slave2 src]#  tar -xzvf Python-3.6.0.tgz

下载Python安装包也可以提前下载之后放到/usr/local/src 目录下, 链接: https://pan.baidu.com/s/18fd43wXq9S6Uah73dVHUdQ 提取码: uvsu

8:编译安装包,进入Python目录

[root@slave2 Python-3.6.0]# pwd
/usr/local/src/Python-3.6.0
[root@slave2 Python-3.6.0]#   ./configure --prefix=/usr/local/python
[root@slave2 Python-3.6.0]#    make && make install

编译成功之后会有提示: If you want a release build with all optimizations active (LTO, PGO, etc), please run ./configure --enable-optimizations

superset 详细安装_第7张图片

superset 详细安装_第8张图片.

之后再  /user/local  文件夹下会多一个python文件夹。

9:添加环境变量并刷新

[root@slave2 local]#  echo PATH='/usr/local/python/bin/:$PATH' >> /etc/profile
[root@slave2 local]# 
[root@slave2 local]#  source /etc/profile
[root@slave2 local]# 

10:检查是否安装成功,进入Python环境

[root@slave2 local]# 
[root@slave2 local]# python3.6
Python 3.6.0 (default, Mar 12 2021, 17:05:37) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> exit();
[root@slave2 local]# 

superset 详细安装_第9张图片

但这个时候如果直接输入python, 显示的是2.7.5版本, 所以下一步修改系统默认的Python环境

[root@slave2 local]# python
Python 2.7.5 (default, Nov 16 2020, 22:23:17) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> 

11: 修改系统默认的Python路径, 两个命令

mv /usr/bin/python /usr/bin/python2.7.5

ln -s /usr/local/python/bin/python3.6 /usr/bin/python

[root@slave2 bin]# pwd
/usr/bin
[root@slave2 bin]# 
[root@slave2 bin]# ll python*
lrwxrwxrwx 1 root root    7 Mar 12 11:23 python -> python2
lrwxrwxrwx 1 root root    9 Mar 12 11:23 python2 -> python2.7
-rwxr-xr-x 1 root root 7144 Nov 17 06:23 python2.7
-rwxr-xr-x 1 root root 1835 Nov 17 06:23 python2.7-config
lrwxrwxrwx 1 root root   16 Mar 12 11:23 python2-config -> python2.7-config
lrwxrwxrwx 1 root root   14 Mar 12 11:23 python-config -> python2-config
[root@slave2 bin]# 
[root@slave2 bin]# mv /usr/bin/python /usr/bin/python2.7.5
[root@slave2 bin]# 
[root@slave2 bin]# ln -s /usr/local/python/bin/python3.6 /usr/bin/python
[root@slave2 bin]# 
[root@slave2 bin]# 

superset 详细安装_第10张图片

12: 因为yum是依赖python的, 所以这里我们修改了默认的python,就要修改yum,让他运行指向旧的版本 (修改两个文件)

vim /usr/bin/yum     (打开之后将第一行的 #!/usr/bin/python    改为: #!/usr/bin/python2.7.5)  即可。
修改 /usr/libexec/urlgrabber-ext-down的第一行 (同上)    

superset 详细安装_第11张图片

两个文件修改完成之后再次在终端输入 python  看下版本是不是3.6.0 如果是,就可以了

superset 详细安装_第12张图片

之后回到Python目录安装容器

[root@slave2 bin]#  cd /usr/local/src/Python-3.6.0/
[root@slave2 Python-3.6.0]# 
[root@slave2 Python-3.6.0]#  pwd
/usr/local/src/Python-3.6.0
[root@slave2 Python-3.6.0]# 



13: 安装容器

[root@slave2 Python-3.6.0]#  yum upgrade python-setuptools  (这一步应该是没有包需要更新)

[root@slave2 Python-3.6.0]#  yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel cyrus-sasl-devel openldap-devel

之后执行

[root@slave2 Python-3.6.0]#   python -m pip install --upgrade pip (安装和更新pip)

Collecting pip
  Downloading http://mirrors.aliyun.com/pypi/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 62.7MB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-21.0.1
[root@slave2 Python-3.6.0]# 
[root@slave2 Python-3.6.0]# pip install cryptography
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting cryptography
  Downloading http://mirrors.aliyun.com/pypi/packages/f8/1f/acde6ff69864c5e78b56488e3afd93c1ccc8c2651186e2a5f93d93f64859/cryptography-3.4.6-cp36-abi3-manylinux2014_x86_64.whl (3.2 MB)
     |████████████████████████████████| 3.2 MB 72.7 MB/s 
Collecting cffi>=1.12
  Downloading http://mirrors.aliyun.com/pypi/packages/2b/cf/9a3b04e57191a970836aeaa8b2075574f02fbdb65d6368457a2f13213e7f/cffi-1.14.5-cp36-cp36m-manylinux1_x86_64.whl (401 kB)
     |████████████████████████████████| 401 kB 83.3 MB/s 
Collecting pycparser
  Downloading http://mirrors.aliyun.com/pypi/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 80.4 MB/s 
Installing collected packages: pycparser, cffi, cryptography
Successfully installed cffi-1.14.5 cryptography-3.4.6 pycparser-2.20
[root@slave2 Python-3.6.0]# 

之后执行

[root@slave2 Python-3.6.0]# 
[root@slave2 Python-3.6.0]# pip install virtualenv
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting virtualenv
  Downloading http://mirrors.aliyun.com/pypi/packages/9f/fb/7423637e48cffbb2e567ca113d2b05068f8b457dde998ab487adf7386c86/virtualenv-20.4.2-py2.py3-none-any.whl (7.2 MB)
     |████████████████████████████████| 7.2 MB 14.1 MB/s 
Collecting appdirs<2,>=1.4.3
  Downloading http://mirrors.aliyun.com/pypi/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting filelock<4,>=3.0.0
  Downloading http://mirrors.aliyun.com/pypi/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting distlib<1,>=0.3.1
  Downloading http://mirrors.aliyun.com/pypi/packages/f5/0a/490fa011d699bb5a5f3a0cf57de82237f52a6db9d40f33c53b2736c9a1f9/distlib-0.3.1-py2.py3-none-any.whl (335 kB)
     |████████████████████████████████| 335 kB 74.5 MB/s 
Collecting importlib-metadata>=0.12
  Downloading http://mirrors.aliyun.com/pypi/packages/34/7c/15499080be7cbb30579630238c6472c7c3529deca03bfab7bdead6419cd1/importlib_metadata-3.7.2-py3-none-any.whl (11 kB)
Collecting six<2,>=1.9.0
  Downloading http://mirrors.aliyun.com/pypi/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting importlib-resources>=1.0
  Downloading http://mirrors.aliyun.com/pypi/packages/f0/5e/69e6a0602c1f18d390952177de648468c4a380252858b0022affc3ce7811/importlib_resources-5.1.2-py3-none-any.whl (25 kB)
Collecting zipp>=0.5
  Downloading http://mirrors.aliyun.com/pypi/packages/0f/8c/715c54e9e34c0c4820f616a913a7de3337d0cd79074dd1bed4dd840f16ae/zipp-3.4.1-py3-none-any.whl (5.2 kB)
Collecting typing-extensions>=3.6.4
  Downloading http://mirrors.aliyun.com/pypi/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Installing collected packages: zi

superset 详细安装_第13张图片

14: 新建一个名为venv的容器空间,同时也会新建在当前目录下新建一个venv的文件夹,请提前切换好工作文件夹

[root@slave2 Python-3.6.0]#  python3 -m venv venv

15: 进入venv的容器环境

[root@slave2 Python-3.6.0]#   . venv/bin/activate

(venv) [root@slave2 Python-3.6.0]# 

16: 容器环境下安装superset

(venv) [root@slave2 Python-3.6.0]# pip install superset
Collecting superset
  Downloading http://mirrors.aliyun.com/pypi/packages/46/a5/04f30b4d12c5c8c3b1b8bcb7cc70e6632b08d761eab514edf64232dee237/superset-0.30.1.tar.gz (42.0MB)
    100% |████████████████████████████████| 42.0MB 58.7MB/s 
Installing collected packages: superset
  Running setup.py install for superset ... done
Successfully installed superset-0.30.1
You are using pip version 9.0.1, however version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) [root@slave2 Python-3.6.0]# 
(venv) [root@slave2 Python-3.6.0]# 

17: 提示更新

(venv) [root@slave2 Python-3.6.0]#  pip install --upgrade pip
Collecting pip
  Downloading http://mirrors.aliyun.com/pypi/packages/fe/ef/60d7ba03b5c442309ef42e7d69959f73aacccd0d86008362a681c4698e83/pip-21.0.1-py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 63.5MB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-21.0.1
(venv) [root@slave2 Python-3.6.0]# 
cd /usr/local/src/Python-3.6.0

18:以下是重点,最多坑的地方,因为superset的运行依赖很多第三方库代码,所以安装python的依赖包并保证完整性很费事,有人整理了一个文档将这些依赖包进行汇总,下载此文档后,在本地按照文件安装依赖包就好 安装到python3下载环境:/usr/local/src/Python-3.6.0 (也可以提前下载在放进去)

wget https://github.com/Warding/InternetRecords/blob/master/%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8/superset_requirements.txt

下载连接,记得提前下载放入服务器的话需要放到/usr/local/src/Python-3.6.0 目录下,  链接: 百度网盘 请输入提取码 提取码: 8bvm

superset 详细安装_第14张图片

19: 安装依赖包

(venv) [root@slave2 Python-3.6.0]# pip install -r superset_requirements.txt

superset 详细安装_第15张图片

20:  初始化DB环境 

(venv) [root@slave2 Python-3.6.0]#   superset db upgrade

21: 账户设定

(venv) [root@slave2 Python-3.6.0]# export FLASK_APP=superset

22: 创建账户按提示输入账密就好

(venv) [root@slave2 Python-3.6.0]#  flask fab create-admin

superset 详细安装_第16张图片

23: 下载样例数据,可不执行

(venv) [root@slave2 Python-3.6.0]#  superset load_examples

24: 环境初始化

(venv) [root@slave2 Python-3.6.0]#  superset init

/usr/local/src/Python-3.6.0/venv/lib/python3.6/site-packages/pandas/compat/__init__.py:85: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
  warnings.warn(msg)
INFO:root:logging was configured successfully
/usr/local/src/Python-3.6.0/venv/lib/python3.6/site-packages/flask_caching/__init__.py:189: UserWarning: Flask-Caching: CACHE_TYPE is set to null, caching is effectively disabled.
  "Flask-Caching: CACHE_TYPE is set to null, "
INFO:root:Creating database reference for examples
INFO:root:Syncing role definition
INFO:root:Syncing Admin perms
INFO:root:Syncing Alpha perms
INFO:root:Syncing Gamma perms
INFO:root:Syncing granter perms
INFO:root:Syncing sql_lab perms
INFO:root:Fetching a set of all perms to lookup which ones are missing
INFO:root:Creating missing datasource permissions.
INFO:root:Creating missing database permissions.
INFO:root:Creating missing metrics permissions
INFO:root:Cleaning faulty perms
(venv) [root@slave2 Python-3.6.0]#

26:启动 这里面我指定了端口和IP,分别是-p 和 -h 参数,建议指定成自己的服务器IP和某个端口,网页访问的时候,**还需要将这个端口对外开放,不然你本地登录网页访问会无法成功**

(venv) [root@slave2 Python-3.6.0]# superset run -p 8088 -h 0.0.0.0 --with-threads

superset 详细安装_第17张图片

参考:

在CentOS中安装Superset的操作笔记 - 简书
在CentOS环境中安装superset的全过程演示_哔哩哔哩_bilibili

你可能感兴趣的:(大数据,Linux,kylin,大数据,python,linux,运维)