centos安装redash

首先检查系统版本(注意!以下操作我都是通过root执行,如果不是root用户要使用sudo执行):

lsb_release -a

如果提示命令不可用需要安装

yum install -y redhat-lsb

如果是centos7继续往下看,如果是centos6,请参考:https://blog.csdn.net/qd_xu_ning/article/details/84568453

清理旧版本组件

sudo yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker-latest-logrotate
docker-logrotate
docker-engine

安装yum-utils用来配置repo

yum install -y yum-utils

yum 安装时错误 Couldn't resolve host 解决办法:
在Hosts配置中增加  nameserver 8.8.8.8

  

配置docker repo库

yum-config-manager
 --add-repo
 https://download.docker.com/linux/centos/docker-ce.repo

sudo yum-config-manager --enable docker-ce-nightly

sudo yum-config-manager --enable docker-ce-test

sudo yum install docker-ce docker-ce-cli containerd.io

(6/11): setools-libs-3.3.8-4.el7.x86_64.rpm | 620 kB 00:00:00
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-19.03.8-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY | 35 MB 00:00:30 ETA
docker-ce-19.03.8-3.el7.x86_64.rpm 的公钥尚未安装
(7/11): docker-ce-19.03.8-3.el7.x86_64.rpm | 25 MB 00:00:23
(8/11): docker-ce-cli-19.03.8-3.el7.x86_64.rpm | 40 MB 00:01:25
containerd.io-1.2.13-3.1.el7.x FAILED ============================================- ] 1.5 B/s | 68 MB 4055:04:46 ETA
https://download.docker.com/linux/centos/7/x86_64/nightly/Packages/containerd.io-1.2.13-3.1.el7.x86_64.rpm: [Errno 12] Timeout on https://download.docker.com/linux/centos/7/x86_64/nightly/Packages/containerd.io-1.2.13-3.1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
containerd.io-1.2.13-3.1.el7.x86_64.rpm 的公钥尚未安装 97% [============================================================- ] 2.5 MB/s | 87 MB 00:00:00 ETA
(9/11): containerd.io-1.2.13-3.1.el7.x86_64.rpm

  

换指定版本安装:

 yum install docker-ce-18.06.1.ce-3.el7 docker-ce-cli-18.06.1.ce-3.el7 containerd.io

从 https://download.docker.com/linux/centos/gpg 检索密钥
导入 GPG key 0x621E9F35:
用户ID : "Docker Release (CE rpm) <docker@docker.com>"
指纹 : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
来自 : https://download.docker.com/linux/centos/gpg
是否继续?[y/N]:

尚未安装任何密钥

  

安装失败,应该是是否继续没有收到输入

默认输入y安装:

yum install -y docker-ce-18.06.1.ce-3.el7 docker-ce-cli-18.06.1.ce-3.el7 containerd.io

作为依赖被安装:
  audit-libs-python.x86_64 0:2.8.5-4.el7      checkpolicy.x86_64 0:2.5-8.el7            container-selinux.noarch 2:2.107-3.el7          libcgroup.x86_64 0:0.41-21.el7
  libsemanage-python.x86_64 0:2.5-14.el7      libtool-ltdl.x86_64 0:2.4.2-22.el7_3      policycoreutils-python.x86_64 0:2.5-33.el7      python-IPy.noarch 0:0.75-6.el7
  setools-libs.x86_64 0:3.3.8-4.el7

完毕!

  

systemctl start docker

docker安装完成!

安装docker compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

测试安装:

docker-compose --version

#docker-compose --version
docker-compose version 1.25.5, build 8a1c60f6

  

安装node.js

请参照:https://www.cnblogs.com/liwutao/p/12795545.html

下载redash源码
git clone https://github.com/getredash/redash.git && cd redash

 docker-compose up -d

latest: Pulling from djfarrelly/maildev
e7c96db7181b: Pull complete
5b5ce4d3d5f2: Pull complete
ac289eff61bc: Pull complete
28fbd2f3252d: Pull complete
9c8d49806e7a: Pull complete
84d976eb7288: Pull complete
82e86324423b: Pull complete
af4002c1f982: Pull complete
Digest: sha256:19d9b74bd9f5ecbd0083734f972e63a731a7df0d1f4e61c43b2290984de10901
Status: Downloaded newer image for djfarrelly/maildev:latest
Creating redash_redis_1    ... done
Creating redash_email_1    ... done
Creating redash_postgres_1 ... done
Creating redash_server_1   ... done
Creating redash_scheduler_1 ... done
Creating redash_worker_1    ... done

 

测试创建表

#docker-compose run --rm server create_db

Starting redash_redis_1    ... done
Starting redash_postgres_1 ... done
[2020-04-29 03:42:49,826][PID:1][INFO][alembic.runtime.migration] Context impl PostgresqlImpl.
[2020-04-29 03:42:49,827][PID:1][INFO][alembic.runtime.migration] Will assume transactional DDL.
[2020-04-29 03:42:49,839][PID:1][INFO][alembic.runtime.migration] Running stamp_revision  -> e5c7a4e2df4d

  

测试创建数据库

# docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests"

CREATE DATABASE

  

启动redash

# docker-compose start
Starting redis ... done Starting postgres ... done Starting server ... done Starting worker ... done Starting scheduler ... done Starting email ... done

 

安装npm包:

    已安装nodejs可以忽略,nodejs自带,如果自带版本太低则需要自行升级

# npm run build 

   .   .   .   .   
   .   .   .   .
   .   .   .

Entrypoint app [big] = vendors~app.813c244f345fd86ab4c8.css vendors~app.813c244f345fd86ab4c8.js vendors~app.813c244f345fd86ab4c8.css.map vendors~app.813c244f345fd86ab4c8.js.map app.5eb009ef96987dfd5a16.css app.5eb009ef96987dfd5a16.js app.5eb009ef96987dfd5a16.css.map app.5eb009ef96987dfd5a16.js.map
Entrypoint server = server.b7d8ce2924a657858f20.css server.b7d8ce2924a657858f20.js server.b7d8ce2924a657858f20.css.map server.b7d8ce2924a657858f20.js.map

启动redash服务  

#npm run start

  

官方文档:https://redash.io/help/open-source/dev-guide/docker

 http://localhost:5000打开界面报错:

FileNotFoundError: [Errno 2] No such file or directory: '/app/redash/settings/../../client/dist/index.html'

  访问:https://version.redash.io/API/releases 使用资源包,选择版本下载对应资源包,我选择7.0

# wget https://s3.amazonaws.com/redash-releases/redash.7.0.0.b17535.tar.gz

  mkdir -p /data/redash-dependencies/redash_res && cd /data/redash-dependencies/redash_res

# tar -xzvf redash.7.0.0.b17535.tar.gz

  

# docker-compose -f docker-compose.yml run --rm server create_db

   .   .   .  .  .   .

   .  .  .  .  .  .    

Requirement already satisfied (use --upgrade to upgrade): sqlalchemy in /usr/local/lib/python2.7/dist-packages (from pymapd==0.7.1->-r requirements_all_ds.txt (line 24))
Collecting numpy (from pymapd==0.7.1->-r requirements_all_ds.txt (line 24))
Downloading https://files.pythonhosted.org/packages/0c/e8/c49cb52ed2ad734efb49eb1f7766888b0e65df1848f71fa7f7fd52183392/numpy-1.18.3.zip (5.4MB)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-rkXjrm/numpy/setup.py", line 32, in <module>
raise RuntimeError("Python version >= 3.5 required.")
RuntimeError: Python version >= 3.5 required.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-rkXjrm/numpy/
You are using pip version 8.1.1, however version 20.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Service 'server' failed to build: The command '/bin/sh -c if [ "x$skip_ds_deps" = "x" ] ; then pip install -r requirements_all_ds.txt ; else echo "Skipping pip install -r requirements_all_ds.txt" ; fi' returned a non-zero code: 1

  

原文地址:https://www.cnblogs.com/liwutao/p/12794702.html