Saturday, December 28, 2024
Google search engine
HomeData Modelling & AIInstall Redash Data Visualization Dashboard on Ubuntu 22.04/20.04/18.04

Install Redash Data Visualization Dashboard on Ubuntu 22.04/20.04/18.04

This blog post will cover the installation of Redash Data Visualization Dashboard on Ubuntu 22.04/20.04/18.04 LTS Linux operating systems. Redash is a data visualization tool built to allow for fast and easy access to billions of records collected from various data sources.

Today Redash has support for querying multiple databases, including: Redshift, Google BigQuery, PostgreSQL, MySQL, Graphite, Presto, Google Spreadsheets, Cloudera Impala, Hive and custom scripts. The dashboards supported are charts, pivot table, cohorts and many more.

For CentOS / Fedora, use:

Redash consists of two parts:

  1. Query Editor: This is your editor for SQL queries. You can browse schema and import with a click of a button.
  2. Visualizations and Dashboards: create different visualizations from your dataset, and then combine several visualizations into a single dashboard.

Features of Redash

  • It gives you a powerful query editor with collaboration capabilities
  • Rich API – You get an API for accessing Redash and extend its functionality.
  • User Management: Redash support SSO, access control and many other great features for enterprise-friendly workflow.
  • Alerts: Set up alerts and get notified on certain events on your data.
  • Support for many Data Sources: Redash supports SQL, NoSQL, Big Data and API data sources – query your data from different sources to answer complex questions. Redash supports more than 25 data sources.

Setup Environment

This installation of Redash has the following dependencies

  • Installed and running Ubuntu 22.04/20.04/18.04 LTS server
  • Docker Engine
  • Docker compose

The installation of Redash Data Visualization Dashboard on Ubuntu 22.04|20.04|18.04  can be done from a script which automates the process for you, or manual steps.

Step 1: Update Ubuntu system

As a rule of thumb, your system should be updated before installing any packages.

sudo apt update && sudo apt upgrade -y
[ -f /var/run/reboot-required ] && sudo reboot -f

Once the system is rebooted, proceed to step 2

Step 2: Install Docker and Docker Compose

Run the following commands to install Docker on Ubuntu 22.04/20.04/18.04:

sudo apt update 
sudo apt -yy install apt-transport-https ca-certificates curl software-properties-common wget pwgen
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update && sudo apt -y install docker-ce docker-ce-cli containerd.io

Allow the current user to run Docker commands

sudo usermod -aG docker $USER
newgrp docker

Install Docker Compose:

curl -s https://api.github.com/repos/docker/compose/releases/latest \
  | grep browser_download_url \
  | grep docker-compose-linux-x86_64 \
  | cut -d '"' -f 4 \
  | wget -qi -

Make the file executable

chmod +x docker-compose-linux-x86_64

Move the file to your PATH.

sudo mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose

Confirm version.

$ docker-compose version
Docker Compose version v2.11.2

Confirm docker installation by checking the version:

$ docker --version
Docker version 20.10.19, build d85ef84

Step 3: Prepare environment and install Redash

You can perform the installation automatically via a bash setup script or manually step-by-step. Let’s consider both applicable methods:

Method 1: Automated installation with Script (Easy way)

You can download and run Redash installation script without following all the steps shown in the next manual installation section.

curl -sLO https://raw.githubusercontent.com/getredash/setup/master/setup.sh

Make the script executable and run it

chmod +x setup.sh
sudo ./setup.sh

The script will:

  1. Install both Docker and Docker Compose.
  2. Download  Docker Compose configuration files and bootstrap Redash environment
  3. Start all Redash docker containers

Confirm containers were created and in running status:

$ docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS          PORTS                                        NAMES
585c3f4b103e   redash/nginx:latest          "nginx -g 'daemon of…"   8 seconds ago    Up 6 seconds    0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   redash_nginx_1
5251cda6c31d   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   11 seconds ago   Up 8 seconds    5000/tcp                                     redash_adhoc_worker_1
9cfe9e0420f0   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   11 seconds ago   Up 8 seconds    5000/tcp                                     redash_scheduler_1
c7c7e70f3064   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   11 seconds ago   Up 8 seconds    0.0.0.0:5000->5000/tcp, :::5000->5000/tcp    redash_server_1
32d86157ddd5   redash/redash:8.0.0.b32245   "/app/bin/docker-ent…"   11 seconds ago   Up 9 seconds    5000/tcp                                     redash_scheduled_worker_1
9fa87c895323   redis:5.0-alpine             "docker-entrypoint.s…"   51 seconds ago   Up 50 seconds   6379/tcp                                     redash_redis_1
52726c94eb0f   postgres:9.6-alpine          "docker-entrypoint.s…"   51 seconds ago   Up 50 seconds   5432/tcp                                     redash_postgres_1

Method 2: Doing Manual installation (Longer manual way)

If you’re a person who likes to manually setup stuff, then this section is for you. The steps are obtained from the script.

Create Project directory

REDASH_BASE_PATH=/opt/redash
sudo mkdir -p $REDASH_BASE_PATH
sudo chown $USER:$USER $REDASH_BASE_PATH

Create PostgreSQL data directory

sudo mkdir $REDASH_BASE_PATH/postgres-data

Create the envfile to store variables

rm $REDASH_BASE_PATH/env 2>/dev/null
touch $REDASH_BASE_PATH/env

Export required variables

COOKIE_SECRET=$(pwgen -1s 32)
POSTGRES_PASSWORD=$(pwgen -1s 32)
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@postgres/postgres"
echo "PYTHONUNBUFFERED=0" >> $REDASH_BASE_PATH/env
echo "REDASH_LOG_LEVEL=INFO" >> $REDASH_BASE_PATH/env
echo "REDASH_REDIS_URL=redis://redis:6379/0" >> $REDASH_BASE_PATH/env
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $REDASH_BASE_PATH/env
echo "REDASH_COOKIE_SECRET=$COOKIE_SECRET" >> $REDASH_BASE_PATH/env
echo "REDASH_DATABASE_URL=$REDASH_DATABASE_URL" >> $REDASH_BASE_PATH/env

Setup Docker Compose

REQUESTED_CHANNEL=stable
LATEST_VERSION=`curl -s "https://version.redash.io/api/releases?channel=$REQUESTED_CHANNEL"  | json_pp  | grep "docker_image" | head -n 1 | awk 'BEGIN{FS=":"}{print $3}' | awk 'BEGIN{FS="\""}{print $1}'`

cd $REDASH_BASE_PATH
REDASH_BRANCH="${REDASH_BRANCH:-master}" # Default branch/version to master if not specified in REDASH_BRANCH env var
wget https://raw.githubusercontent.com/getredash/redash/${REDASH_BRANCH}/setup/docker-compose.yml
sed -ri "s/image: redash\/redash:([A-Za-z0-9.-]*)/image: redash\/redash:$LATEST_VERSION/" docker-compose.yml
echo "export COMPOSE_PROJECT_NAME=redash" >> ~/.profile
echo "export COMPOSE_FILE=/opt/redash/docker-compose.yml" >> ~/.profile
source ~/.profile
docker-compose run --rm server create_db
docker-compose up -d

The setup may take a couple of minutes to finish. When done, you should have a number of containers running

install redash ubuntu 18.04 check containers running min

Step 4: Access Redash Dashboard

Once Redash is installed, the service will be available on your server IP or DNS name assigned. Point your browser to the server address to access it.

install redash ubuntu 18.04 check create admin user min

The first thing you’re asked to do is create your admin account, fill the information required then click the “Setup” button. It will finish the setup and greet you with the admin dashboard

 You can now start using Redash to create Dashboards, Queries, and Alerts. For more reading on administration, visit Redash Admin page.

If you need SSL, follow Redash SSL setup guide for Nginx.

RELATED ARTICLES

Most Popular

Recent Comments