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
| Layer | Component | Role | 
|---|---|---|
| OS | AlmaLinux 9 | Enterprise-grade RHEL-compatible base system with SELinux | 
| Container Runtime | Docker Engine + Compose | Orchestrates Metabase and PostgreSQL containers | 
| Database | PostgreSQL 15 | Stores dashboards, users, and configuration data | 
| Application | Metabase Server | Provides BI interface, dashboard creation, and visualization engine | 
| Reverse Proxy | Nginx (optional) | Handles HTTPS termination, caching, and routing | 
| TLS | Let’s Encrypt / PKI | Enables 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/Capability | Metabase (Self-hosted) | Tableau (Cloud) | Power BI (Microsoft) | Apache 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 | Wide (SQL databases) | Very wide | Microsoft-centric | Wide (SQL databases) | 
| Ease of use | Very easy | Moderate | Moderate | Developer-focused | 
| Ideal for | SMBs, startups, teams | Enterprises | Enterprises | Data 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 .envfiles 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_dumpor 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.

Choose a data center location close to your users.

Select a plan with at least 2 CPUs, 4 GB RAM, and 20 GB SSD.
Choose AlmaLinux 9 (64-bit) as the operating system.

Click Create Instance.

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

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

Install required utilities:
dnf install yum-utils curl
These packages enable repository management and downloading external keys.

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

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.

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
| Component | Description | 
|---|---|
| db | PostgreSQL database for Metabase. | 
| metabase | The Metabase application running on port 3000. | 
| volumes | Persistent data storage for both the database and Metabase. | 
Save the file (CTRL + O, then CTRL + X).

Step 6: Deploy Metabase with Docker Compose
Pull the required Docker images:
docker compose pull

Start the containers in the background:
docker compose up -d

Check if containers are running:
docker compose ps
You should see metabase-app and metabase-postgres with the status Up.

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.

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

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.

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.

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

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

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.