(Last Updated On: November 19, 2018)

This blog post will cover the installation of Redash Data Visualization Dashboard on Ubuntu 18.04 LTS release. 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: Installing Redash Data Visualization Dashboard on CentOS 7 / Fedora

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 18.04 LTS server
  • Docker Engine
  • Docker compose

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

Step 1: Update Ubuntu 18.04 system

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

sudo apt update
sudo apt upgrade
sudo reboot

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 18.04:

sudo apt-get update 
sudo apt-get -yy install apt-transport-https ca-certificates curl software-properties-common wget pwgen
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update && sudo apt-get -y install docker-ce

Install Docker Compose

export VER="1.22.0"
sudo curl -L https://github.com/docker/compose/releases/download/${VER}/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose

Make the file executable

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

Allow the current user to run Docker commands

sudo usermod -aG docker $USER
newgrp docker

Step 3: Prepare environment and install Redash

Automated with Script

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

wget https://raw.githubusercontent.com/getredash/redash/master/setup/setup.sh

Make the script executable and run it

chmod +x setup.sh
./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

Doing Manual installation

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

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.

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.