Metabase with PostgreSQL on Ubuntu 24.04 (Docker Compose + Nginx + SSL)

Metabase is an open-source business intelligence (BI) and data visualization platform that makes it easy for teams to explore, analyze, and visualize data — without needing complex SQL queries. With an intuitive web-based interface, users can create dashboards, charts, and reports directly from databases such as PostgreSQL, MySQL, or MongoDB.

Running Metabase on Ubuntu 24.04 LTS (Noble Numbat) with PostgreSQL provides a stable, secure, and high-performance analytics environment. Ubuntu 24.04 offers systemd 255, OpenSSL 3, and updated Docker support, making it an excellent foundation for deploying Metabase in production with Docker Compose, Nginx reverse proxy, and SSL encryption.


Architecture Overview

LayerComponentRole
OSUbuntu 24.04 LTSSecure and long-term supported Linux base
Container RuntimeDocker Engine + ComposeOrchestrates Metabase and PostgreSQL containers
DatabasePostgreSQL 15/16Stores Metabase configurations, dashboards, and user data
ApplicationMetabase ServerProvides BI dashboards, queries, and visualization interface
Reverse ProxyNginx (optional)Handles HTTPS, caching, compression, and routing
TLSLet’s Encrypt / PKISecures connections to the web interface via HTTPS

Why Use Metabase?

  • Self-hosted BI platform – analyze your data without relying on SaaS tools.
  • Simple, no-code interface – build dashboards and charts visually.
  • SQL support – write and optimize custom SQL queries when needed.
  • Integrates easily – connects with PostgreSQL, MySQL, BigQuery, and others.
  • Open-source and free – deploy anywhere with no license restrictions.
  • Enterprise features – LDAP, SSO, and advanced permissions (in paid tiers).

Metabase vs Other BI Tools

Feature/CapabilityMetabase (Self-hosted)Tableau (Cloud)Power BI (Microsoft)Superset (Self-hosted)
HostingSelf-hosted (Docker)SaaS / DesktopSaaS / Windows onlySelf-hosted (Docker)
CostFree, open-sourceSubscriptionSubscriptionFree, open-source
Database supportSQL databasesBroadMicrosoft-centricSQL databases
Ease of useVery easyModerateModerateDeveloper-focused
Ideal forSmall to mid teamsEnterprisesEnterprisesData engineers

Metabase is ideal for teams that want powerful analytics without vendor lock-in or complex enterprise software dependencies.


Security & Best Practices

  • Run Metabase behind Nginx with HTTPS enabled.
  • Store PostgreSQL credentials in Docker secrets or .env securely.
  • Use a dedicated PostgreSQL user with limited privileges.
  • Keep Ubuntu, Docker, and Metabase images updated regularly.
  • Automate database backups using pg_dump or snapshot tools.
  • Restrict PostgreSQL access to internal Docker networks only.
  • Automate SSL renewals with Certbot or Traefik’s ACME integration.
  • Use strong admin credentials and restrict dashboard access by roles.

Typical Use Cases

  • Data analytics and BI dashboards for startups and enterprises.
  • Marketing or sales analytics powered by PostgreSQL data.
  • Internal KPI monitoring and performance dashboards.
  • Product usage analytics for SaaS and web applications.
  • Centralized reporting across multiple data sources.

Deploying Metabase with PostgreSQL on Ubuntu 24.04 gives you a modern, secure, and scalable analytics platform that empowers your team to visualize data, discover insights, and make data-driven decisions — all while keeping full 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 your preferred server location.

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

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

Choose Ubuntu 24.04 (64-bit) as the OS.

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

Click Create Instance.

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

After provisioning, copy the instance’s public IP address from the Resources section.

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

Step 2: Connect to Your Server

Use SSH to connect:

  • Linux / macOS: ssh root@your_server_ip
  • Windows (PuTTY):
    1. Open PuTTY → enter your IP.
    2. Click Open and log in as root.

Step 3: Install Docker Engine and Docker Compose

Update system packages:

apt update
Terminal showing APT package management commands and output.

Install required dependencies for secure repositories:

apt install ca-certificates curl gnupg lsb-release
Terminal showing APT package management commands and output.

Create a key directory for Docker:

mkdir -p /etc/apt/keyrings

Download Docker’s GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

Add Docker’s official repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
> /etc/apt/sources.list.d/docker.list

Update package lists again:

apt update
Terminal showing APT package management commands and output.

Install Docker Engine, CLI, and Compose plugin:

apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Terminal showing APT package management commands and output.

Enable Docker to start automatically:

systemctl enable docker

Start the Docker service:

systemctl start docker

Check installed versions:

docker --version
docker compose version
Terminal showing systemd service management commands or output.

Step 4: Set Up the Metabase Directory

Create a working folder:

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

Step 5: Create the Docker Compose Configuration

Open a new file:

nano docker-compose.yml

Paste the following configuration:

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
    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
    depends_on:
      - db
    volumes:
      - mb-data:/metabase-data

volumes:
  pgdata:
  mb-data:

Explanation

ServiceDescription
dbA PostgreSQL 15 container storing Metabase’s internal data.
metabaseThe Metabase web application itself.
pgdata / mb-dataDocker volumes for persistent storage of database and app data.

Save and exit (CTRL + O, then CTRL + X).

Terminal showing application configuration settings.

Step 6: Deploy Metabase

Pull the latest container images:

docker compose pull
Terminal showing container image download progress.

Start the containers:

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

Check that both containers are running:

docker compose ps

You should see both metabase-app and metabase-postgres marked as Up.

Terminal showing docker commands or output during Deploy Metabase.

Step 7: Access Metabase

Open your browser and go to:

http://YOUR_SERVER_IP:3000

You’ll see the Metabase setup wizard.

  • Create an admin account.
  • Connect to the existing PostgreSQL database (configured automatically).
  • Start building dashboards and visualizations.
  • Welcome to Metabase
  • The welcome page confirms that Metabase is working.
  • Click on “Let’s get started” to begin the setup process.
Metabase getting started screen.

Choose Your Language

Metabase asks for your preferred interface language.

  • Select English (or another language if you prefer).
  • Click Next.
Metabase setup interface.

Administrator Account Setup

Create your admin profile for Metabase.

Fill in the fields as shown:

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

Click Next to continue.

Metabase setup interface.

Usage Purpose

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

Self-service analytics for my own company

This setting helps Metabase tailor the experience to your needs.
Click Next.

Metabase setup interface.

Database Connection

Here, you can connect Metabase to your data source.

Since we’ve already configured PostgreSQL earlier, you can either:

  • Connect your PostgreSQL database now,
    or
  • Click Continue with sample data to explore Metabase first.

Later, you can go to Admin > Databases > Add Database to connect your PostgreSQL server manually.

Metabase setup interface.

Data Collection Preferences

Metabase asks if you want to send anonymous usage data to improve their platform.
You can:

  • Keep it enabled (default), or
  • Disable it for privacy.

Click Finish to complete the setup.

Metabase setup interface.

Metabase Home Page

After setup, you’ll reach the Metabase dashboard.
You can now:

  • Browse sample analytics (Accounts, Orders, Reviews, Invoices, etc.)
  • Connect your PostgreSQL database from the left panel (Add data)
  • Start creating dashboards, models, and visualizations
Metabase home page showing data exploration and getting started options.

You’ve successfully installed Metabase with PostgreSQL on Ubuntu 24.04 using Docker Compose.
Your analytics stack is now ready for secure, scalable data visualization and reporting.

For better performance and uptime, deploy Metabase on a Shape.Host Linux SSD VPS, optimized for container workloads and real-time data analysis.