Centos7内置的Python版本为Python2,Redash中文版是在Python3基础上的安装。所以需要安装Python3版本.以下是安装步骤:

视频:本文详细视频教程(bilibili) 下载:百度网盘(提取码:1234)

1.初始化
1.1进入源文件目录下:cd /etc/yum.repos.d/
1.2备份原版本yum文件:
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
1.3下载阿里yum源文件作为默认源文件:
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
1.4清理原缓存:sudo yum clean all
1.5建立缓存以后方便缓存中搜索:sudo yum makecache
1.6更新系统包:sudo yum update -y
1.7安装常用包:
sudo yum -y install gcc gcc-c++ kernel-devel make zlib zlib-devel libffi-devel openssl-devel git python3-devel postgresql-devel*
1.8进入root用户下修改当前用户添加到root组:
su - sudo usermod -g root 当前centos用户名
2.安装PostgreSql9.6
2.1安装postgresql源:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat-repo-42.0-11.noarch.rpm
2.2安装postgresql6客户端:sudo yum install -y postgresql96
2.3安装postgresql6服务端:sudo yum install -y postgresql96-server
2.4初始化:sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
2.5设置开机自启:sudo systemctl enable postgresql-9.6
2.6启动postgresql9.6服务:sudo systemctl start postgresql-9.6
2.7进入postgresql数据库修改用户名密码:
sudo -u postgres psql alter user postgres with password ‘此处填写登陆密码’; create role 当前centos用户名; alter role 当前centos用户名 login; \q
3、安装Redis

下载fedora的epel仓库:sudo yum install epel-release -y
安装:sudo yum install redis
启动:redis:sudo systemctl start redis
设置开机自启:sudo systemctl enable redis.service

4.安装Python3

sudo yum -y groupinstall “Development tools” sudo 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 python3-devel sudo wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz sudo mkdir /usr/local/python3 tar -xvJf Python-3.6.2.tar.xz cd Python-3.6.2 ./configure –prefix=/usr/local/python3 sudo make && sudo make install
添加环境变量:
sudo vi /etc/profile
将下面内容添加到文件的最下面
PATH=$PATH:/usr/local/python3/bin
随后使环境变量生效
source /etc/profile

5安装Redash中文版
5.1进入家目录:cd ~
下载代码:git clone https://github.com/dazdata/redash.git
5.2进入工作目录:cd redash
***************注意***************
redash前端资源安装方式有两种:
第一种:下载前端资源压缩包dist.zip,
将其上传到redash工作目录~/redash/client/下,随后解压至当前目录即可.

第二种:下载前端源码按照以下步骤:
安装nodejs和npm:sudo apt install nodejs npm
更换npm国内源:npm config set registry https://registry.npm.taobao.org
安装nodejs版本管理器:sudo npm install n -g
升级nodejs最新版本:sudo n stable
安装npm依赖包:npm install
前端打包:npm run build
********************************

5.3配置pip国内源:sudo cp pip.conf /etc/pip.conf
5.4安装Python虚拟环境:sudo pip3 install virtualenv
5.5创建Python虚拟环境:virtualenv -p python3 venv
5.6激活Python虚拟环境:source venv/bin/activate
5.7安装pip包:pip3 install -r requirements.txt -r requirements_dev.txt
5.8Python3.8安装pip包:pip3 install importlib_resources==1.5
5.9初化数据库表结构:./manage.py database create_tables
退出虚拟环境,安装完成:deactivate
6.启动
分别打开三个终端,都执行cd redash进入目录后分别执行下列三个命令之一:
source venv/bin/activate ./manage.py runserver --debugger --reload 和 source venv/bin/activate ./manage.py rq worker 和 source venv/bin/activate ./manage.py rq scheduler
打开浏览器,输入地址:http://localhost:5000

匹配结果 ""

    没有匹配结果 ""