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

Metabase is an open-source business intelligence (BI) and analytics platform that helps teams explore, visualize, and share data quickly — without writing complex SQL. With its intuitive web-based interface, anyone can create dashboards, charts, and reports directly from databases like PostgreSQL, MySQL, or MongoDB, empowering both developers and non-technical users to make data-driven decisions.

Running Metabase on Rocky Linux 9, a community-driven, RHEL-compatible enterprise operating system, ensures a secure, stable, and long-term supported environment for analytics workloads. With SELinux enforcement, systemd 252, OpenSSL 3, and the latest Docker stack, Rocky Linux 9 provides the ideal base for deploying Metabase with PostgreSQL, Nginx, and SSL encryption using Docker Compose.


Architecture Overview

LayerComponentRole
OSRocky Linux 9RHEL-compatible, enterprise-grade Linux with SELinux enabled
Container RuntimeDocker Engine + ComposeOrchestrates Metabase and PostgreSQL containers
DatabasePostgreSQL 15Stores dashboards, user accounts, queries, and configuration data
ApplicationMetabase ServerProvides the BI interface, data exploration, and visualization tools
Reverse ProxyNginx (optional)Handles HTTPS termination, routing, and caching
TLSLet’s Encrypt / PKIProvides HTTPS security for the Metabase web interface

Why Use Metabase?

  • Self-hosted analytics – full control of your data and environment.
  • No-code dashboards – create charts and visualizations without SQL.
  • SQL for power users – advanced query editor for deeper analysis.
  • Broad compatibility – connects with PostgreSQL, MySQL, BigQuery, and more.
  • Open-source and cost-free – deploy anywhere, scale easily.
  • Enterprise-ready options – SSO, LDAP, and enhanced governance 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 supportSQL databasesBroadMicrosoft-focusedSQL databases
Ease of useVery easyModerateModerateDeveloper-oriented
Ideal forTeams, SMBs, startupsEnterprisesEnterprisesData engineers

Metabase is perfect for organizations that want to manage analytics in-house, with the flexibility and transparency of open-source software.


Security & Best Practices

  • Run Metabase behind Nginx or Traefik with HTTPS enabled.
  • Store credentials and environment variables securely using Docker secrets.
  • Restrict PostgreSQL to internal Docker networks only.
  • Enforce SELinux policies to protect containers and network access.
  • Keep Docker images, Rocky Linux, and PostgreSQL updated regularly.
  • Automate PostgreSQL backups using pg_dump or volume snapshots.
  • Use firewalld or nftables to expose only ports 80 and 443.
  • Automate SSL renewals via Certbot or Traefik ACME integration.

Typical Use Cases

  • Data dashboards for small to enterprise teams.
  • Marketing and sales analytics powered by PostgreSQL.
  • Finance and KPI tracking across business units.
  • Product analytics for SaaS platforms and web applications.
  • Centralized BI solution integrating multiple data sources.

Deploying Metabase with PostgreSQL on Rocky Linux 9 provides a secure, scalable, and enterprise-ready analytics platform that empowers your team to visualize data, uncover insights, and drive smarter business decisions — while maintaining complete control of your infrastructure.


Step 1: Create a Server Instance on Shape.Host

Go to Shape.Host and log in.

Click Create → Instance.

Shape.host Resources dashboard with Create > Instance highlighted.

Choose a server location near your target 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 Rocky Linux 9 (64-bit) as the operating system.

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

Click Create Instance to deploy your VPS.

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

Once the instance is ready, find and copy its public IP address from the Resources section.

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

Step 2: Connect to Your Instance

Use SSH to log in to the server.

  • Linux / macOS: ssh root@your_server_ip
  • Windows (PuTTY):
    1. Open PuTTY.
    2. Enter your IP address and click Open.
    3. Log in as root.

Step 3: Install Docker and Docker Compose

Update system packages to ensure everything is up to date:

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

Install utility tools for repository management and downloads:

dnf install yum-utils curl
Terminal showing DNF/YUM package management commands and output.

yum-utils allows repository configuration, and curl is used to download the Docker repo key.

Add Docker’s official repository for CentOS/Rocky Linux:

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.

This installs all required Docker components, including the new Docker Compose plugin.

Enable Docker to start automatically on system boot:

systemctl enable docker

Start Docker now:

systemctl start docker

Check installed versions to confirm proper installation:

docker --version
docker compose version

Step 4: Create the Metabase Directory

Create a directory to store Metabase configuration and data:

mkdir -p /opt/metabase
cd /opt/metabase
Terminal showing systemd service management commands or output.

Step 5: Create the Docker Compose File

Open a new Docker Compose configuration file:

nano docker-compose.yml

Paste the following content exactly as shown:

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 of the configuration

SectionDescription
dbRuns a PostgreSQL 15 container as the Metabase database backend.
metabaseRuns the Metabase web app, connected to the PostgreSQL database.
volumesPersistent storage for database and application data so it isn’t lost after restarts.

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

Terminal showing application configuration settings.

Step 6: Deploy Metabase

Download the latest images for PostgreSQL and Metabase:

docker compose pull
Terminal showing container image download progress.

Start the containers in detached mode:

docker compose up -d
Terminal showing Docker Compose image downloads and container startup output.

List running containers to confirm everything is active:

docker compose ps

If both metabase-app and metabase-postgres show as Up, the setup is successful.

Terminal showing docker commands or output during Deploy Metabase.

Step 7: Access Metabase

Now open your web browser and navigate to:

http://YOUR_SERVER_IP:3000

You’ll see the Metabase Setup Wizard, where you can:

  • Create an admin user
  • Configure your PostgreSQL database connection
  • Begin creating dashboards and reports

Welcome to Metabase

You’ll see a welcome message confirming that everything is working.
Click “Let’s get started” to begin.

Metabase getting started screen.

Choose Your Language

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

Metabase setup interface.

Create Administrator Account

Next, create an admin account for your Metabase instance.

Enter the following information:

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

Click Next to continue.

Metabase setup interface.

Define Usage Purpose

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

Self-service analytics for my own company

Click Next to proceed.

Metabase setup interface.

Connect a Database

At this point, Metabase allows you to connect to a database.

If you already configured PostgreSQL, choose PostgreSQL and fill in the connection details:

  • Host: your server IP or hostname
  • Port: 5432 (default for PostgreSQL)
  • Database name: your database name
  • Username: your PostgreSQL user
  • Password: your PostgreSQL password

If you prefer to explore the interface first, click Continue with sample data.
You can add your PostgreSQL database later from Admin → Databases → Add Database.

Metabase settings interface.

Data Collection Preferences

Metabase asks whether you want to share anonymous usage data to help improve the platform.
You can leave the option enabled or disable it for privacy.

Click Finish to finalize the configuration.

Metabase setup interface.

Explore the Metabase Dashboard

Screenshot 7 – Home Page

After setup, you’ll be redirected to the main Metabase dashboard.

From here, you can:

  • View the example dashboards and charts
  • Add your own data sources
  • Create visualizations and reports
  • Manage collections, models, and metrics from the left panel
Metabase home page showing data exploration and getting started options.

You’ve successfully installed Metabase with PostgreSQL on Rocky Linux 9 using Docker Compose.
You now have a professional, containerized analytics platform ready for business intelligence and data visualization.

For best performance and uptime, host your stack on a Shape.Host Cloud VPS, offering SSD storage, full root access, and scalable resources ideal for Docker environments.