Metabase with PostgreSQL on AlmaLinux 9 (Docker Compose + Nginx + SSL)

Metabase is an open-source business intelligence (BI) and data analytics platform that helps organizations visualize, analyze, and share data effortlessly. It offers an intuitive, web-based interface for creating dashboards, charts, and reports — without needing deep SQL knowledge. Built for everyone from data analysts to executives, Metabase makes it simple to transform database data into actionable insights.

Running Metabase on AlmaLinux 9, a RHEL-compatible enterprise Linux distribution, ensures a stable, secure, and long-term supported environment. With SELinux enforcement, systemd 252, and modern Docker + Compose support, AlmaLinux 9 provides an ideal platform for deploying Metabase with PostgreSQL, Nginx, and SSL encryption in production.


Architecture Overview

LayerComponentRole
OSAlmaLinux 9Enterprise-grade RHEL-compatible base system with SELinux
Container RuntimeDocker Engine + ComposeOrchestrates Metabase and PostgreSQL containers
DatabasePostgreSQL 15Stores dashboards, users, and configuration data
ApplicationMetabase ServerProvides BI interface, dashboard creation, and visualization engine
Reverse ProxyNginx (optional)Handles HTTPS termination, caching, and routing
TLSLet’s Encrypt / PKIEnables secure HTTPS connections for Metabase’s web interface

Why Use Metabase?

  • Self-hosted analytics – explore and visualize your data without cloud dependency.
  • No-code dashboards – perfect for non-technical users.
  • SQL mode for power users – write advanced queries when needed.
  • Integrates easily – connect PostgreSQL, MySQL, BigQuery, and more.
  • Free and open-source – deploy anywhere with no licensing costs.
  • Enterprise-ready – LDAP, SSO, and advanced permissions in paid tiers.

Metabase vs Other BI Tools

Feature/CapabilityMetabase (Self-hosted)Tableau (Cloud)Power BI (Microsoft)Apache Superset (Self-hosted)
HostingSelf-hosted (Docker)SaaS / DesktopSaaS / Windows onlySelf-hosted (Docker)
CostFree, open-sourceSubscriptionSubscriptionFree, open-source
Database supportWide (SQL databases)Very wideMicrosoft-centricWide (SQL databases)
Ease of useVery easyModerateModerateDeveloper-focused
Ideal forSMBs, startups, teamsEnterprisesEnterprisesData engineers

Metabase is ideal for teams and organizations seeking a self-hosted BI solution that combines simplicity, scalability, and complete data ownership.


Security & Best Practices

  • Run behind Nginx or Traefik with HTTPS enabled.
  • Use Docker secrets or .env files to store PostgreSQL credentials securely.
  • Restrict PostgreSQL to internal Docker networks only.
  • Run Metabase and PostgreSQL under non-root containers for safety.
  • Enable and configure SELinux to protect against unauthorized access.
  • Keep AlmaLinux, Docker, and Metabase containers updated.
  • Automate SSL renewals with Certbot or Traefik ACME integration.
  • Back up PostgreSQL data regularly using pg_dump or volume snapshots.

Typical Use Cases

  • Business analytics and KPI dashboards for startups and enterprises.
  • Marketing and sales reporting based on PostgreSQL data.
  • Product and customer behavior analysis for SaaS platforms.
  • Finance and operations dashboards for internal monitoring.
  • Centralized BI system connecting multiple databases and teams.

Deploying Metabase with PostgreSQL on AlmaLinux 9 gives you a secure, scalable, and enterprise-grade analytics platform that allows your team to visualize and explore data in real-time — all while maintaining full control of your infrastructure.


Step 1: Create a Server Instance on Shape.Host

Log in to your Shape.Host account.

Click Create → Instance.

Shape.host Resources dashboard with Create > Instance highlighted.

Choose a data center location close to your users.

Shape.host instance form with the data center location selector highlighted.

Select a plan with at least 2 CPUs, 4 GB RAM, and 20 GB SSD.

Choose AlmaLinux 9 (64-bit) as the operating system.

Shape.host instance form with the operating system image selector highlighted.

Click Create Instance.

Shape.host instance form with the Create Instance button highlighted.

Once the instance is created, note the public IP address — you’ll use it later to access Metabase.

Shape.host Resources dashboard with the server IP address highlighted.

Step 2: Connect to Your Server

Use SSH to connect to the instance:

ssh root@your_server_ip

Once logged in, you’re ready to begin.


Step 3: Install Docker and Docker Compose

Update system packages:

dnf update
Terminal showing DNF/YUM package management commands and output.

Install required utilities:

dnf install yum-utils curl

These packages enable repository management and downloading external keys.

Terminal showing DNF/YUM package management commands and output.

Add Docker’s official repository:

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

Install Docker Engine, CLI, and Compose plugin:

dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Terminal showing DNF/YUM package management commands and output.

Enable Docker to start on boot:

systemctl enable docker

Start the Docker service:

systemctl start docker

Verify Docker installation:

docker --version
docker compose version

Step 4: Set Up Metabase Directory

Create a folder for Metabase:

mkdir -p /opt/metabase
cd /opt/metabase

This directory will store your Docker Compose file and all data volumes.

Terminal showing systemd service management commands or output.

Step 5: Create Docker Compose File

Create and edit the file:

nano docker-compose.yml

Paste the following content:

version: "3.9"

services:
  db:
    image: postgres:15
    container_name: metabase-postgres
    restart: always
    environment:
      POSTGRES_USER: metabase
      POSTGRES_PASSWORD: StrongPassword123!
      POSTGRES_DB: metabase
    volumes:
      - pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"

  metabase:
    image: metabase/metabase:latest
    container_name: metabase-app
    restart: always
    depends_on:
      - db
    ports:
      - "3000:3000"
    environment:
      MB_DB_TYPE: postgres
      MB_DB_DBNAME: metabase
      MB_DB_PORT: 5432
      MB_DB_USER: metabase
      MB_DB_PASS: StrongPassword123!
      MB_DB_HOST: db
    volumes:
      - mb-data:/metabase-data

volumes:
  pgdata:
  mb-data:

Explanation

ComponentDescription
dbPostgreSQL database for Metabase.
metabaseThe Metabase application running on port 3000.
volumesPersistent data storage for both the database and Metabase.

Save the file (CTRL + O, then CTRL + X).

Terminal showing the GNU nano editor and configuration text.

Step 6: Deploy Metabase with Docker Compose

Pull the required Docker images:

docker compose pull
Terminal showing container image download progress.

Start the containers in the background:

docker compose up -d
Terminal showing container image download progress.

Check if containers are running:

docker compose ps

You should see metabase-app and metabase-postgres with the status Up.

Terminal showing docker commands or output during Deploy Metabase with Docker Compose.

Step 7: Access Metabase

Once containers are running, open your web browser and go to:

http://YOUR_SERVER_IP:3000

The Metabase Setup Wizard will appear.
You can now:

  • Create an admin account
  • Configure your data sources
  • Start building dashboards and visualizations

Welcome to Metabase

The start page confirms that Metabase is active.
Click “Let’s get started” to begin the configuration process.

Metabase setup interface.

Choose Your Language

Select your preferred interface language.
For most setups, choose English, then click Next.

Metabase setup interface.

Create Administrator Account

You’ll now set up the main administrator account.

Fill in the fields:

  • First name: Andrei
  • Last name: Gh
  • Email: contact@shape.host
  • Company or team name: ShapeHost
  • Password: Choose a strong password
  • Confirm password: Re-enter the password

When done, click Next.

Metabase setup interface.

Define Usage Purpose

Metabase will ask how you plan to use it.
Select:

Self-service analytics for my own company

This option tailors Metabase for internal reporting and analytics.
Click Next to continue.

Metabase setup interface.

Connect Your Database

At this stage, you can connect to an existing database.

If your PostgreSQL instance is already set up, choose PostgreSQL and provide:

  • Hostname or IP
  • Database name
  • Username
  • Password

Alternatively, click Continue with sample data to explore Metabase first using its built-in example database.

You can later connect your PostgreSQL database from:
Admin → Databases → Add Database

Metabase setup interface.

Usage Data Preferences

Metabase asks if it may collect anonymous usage data to help improve the product.

You can:

  • Keep the toggle enabled (default), or
  • Turn it off for privacy.

Click Finish to complete the setup.

Metabase setup interface.

Metabase Home Page

After finishing the setup, you’ll arrive at the main dashboard.
Here you can:

  • View sample dashboards and charts
  • Add and explore your PostgreSQL data
  • Create visualizations, reports, and dashboards
  • Manage data models and metrics from the sidebar
Metabase home page showing data exploration and getting started options.

You’ve successfully installed Metabase with PostgreSQL on AlmaLinux 9 using Docker Compose.
Your analytics environment is now ready for data exploration, dashboards, and business reporting.

For best performance, deploy Metabase on a Shape.Host Linux SSD VPS, optimized for container workloads and real-time analytics — ensuring high uptime and reliability.