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
| Layer | Component | Role | 
|---|---|---|
| OS | Ubuntu 24.04 LTS | Secure and long-term supported Linux base | 
| Container Runtime | Docker Engine + Compose | Orchestrates Metabase and PostgreSQL containers | 
| Database | PostgreSQL 15/16 | Stores Metabase configurations, dashboards, and user data | 
| Application | Metabase Server | Provides BI dashboards, queries, and visualization interface | 
| Reverse Proxy | Nginx (optional) | Handles HTTPS, caching, compression, and routing | 
| TLS | Let’s Encrypt / PKI | Secures 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/Capability | Metabase (Self-hosted) | Tableau (Cloud) | Power BI (Microsoft) | Superset (Self-hosted) | 
|---|---|---|---|---|
| Hosting | Self-hosted (Docker) | SaaS / Desktop | SaaS / Windows only | Self-hosted (Docker) | 
| Cost | Free, open-source | Subscription | Subscription | Free, open-source | 
| Database support | SQL databases | Broad | Microsoft-centric | SQL databases | 
| Ease of use | Very easy | Moderate | Moderate | Developer-focused | 
| Ideal for | Small to mid teams | Enterprises | Enterprises | Data 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 .envsecurely.
- Use a dedicated PostgreSQL user with limited privileges.
- Keep Ubuntu, Docker, and Metabase images updated regularly.
- Automate database backups using pg_dumpor 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.

Choose your preferred server location.

Select a plan with at least 2 CPUs, 4 GB RAM, 20 GB SSD.
Choose Ubuntu 24.04 (64-bit) as the OS.

Click Create Instance.

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

Step 2: Connect to Your Server
Use SSH to connect:
- Linux / macOS: ssh root@your_server_ip
- Windows (PuTTY):
- Open PuTTY → enter your IP.
- Click Open and log in as root.
 
Step 3: Install Docker Engine and Docker Compose
Update system packages:
apt update

Install required dependencies for secure repositories:
apt install ca-certificates curl gnupg lsb-release

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

Install Docker Engine, CLI, and Compose plugin:
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Enable Docker to start automatically:
systemctl enable docker
Start the Docker service:
systemctl start docker
Check installed versions:
docker --version
docker compose version

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
| Service | Description | 
|---|---|
| db | A PostgreSQL 15 container storing Metabase’s internal data. | 
| metabase | The Metabase web application itself. | 
| pgdata / mb-data | Docker volumes for persistent storage of database and app data. | 
Save and exit (CTRL + O, then CTRL + X).

Step 6: Deploy Metabase
Pull the latest container images:
docker compose pull

Start the containers:
docker compose up -d

Check that both containers are running:
docker compose ps
You should see both metabase-app and metabase-postgres marked as Up.

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.

Choose Your Language
Metabase asks for your preferred interface language.
- Select English (or another language if you prefer).
- Click Next.

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.

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.

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.

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

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.