首先檢查系統版本(注意!以下操作我都是通過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