How to Install Metabase for Business Intelligence

Metabase is a self-hosted business intelligence tool that lets non-technical users explore data and build dashboards by connecting directly to your existing databases — without writing SQL.

Prerequisites

  • Docker Engine installed
  • An existing database (MySQL, PostgreSQL, etc.) to connect to
  • 2 vCPU, 2 GB RAM minimum

Step 1 — Run Metabase

docker run -d \
  --name metabase \
  --restart unless-stopped \
  -p 3000:3000 \
  -v metabase_data:/metabase-data \
  -e MB_DB_FILE=/metabase-data/metabase.db \
  metabase/metabase:latest

Step 2 — Allow the Port Through the Firewall

sudo ufw allow 3000/tcp

Step 3 — Access Metabase

http://YOUR_SERVER_IP:3000

Step 4 — Complete Initial Setup

Create an administrator account and connect your first data source when prompted.

Step 5 — Connect to Your Application Database

Provide connection details for your existing MySQL/PostgreSQL database — ideally using a read-only database user dedicated to Metabase, not your application's own credentials:

CREATE USER 'metabase'@'%' IDENTIFIED BY 'CHANGE_ME_STRONG_PASSWORD';
GRANT SELECT ON myapp.* TO 'metabase'@'%';
FLUSH PRIVILEGES;

Step 6 — Restrict Database Access to Metabase's Server Only

If Metabase and the database are on different servers, restrict at the firewall level:

sudo ufw allow from METABASE_SERVER_IP to any port 3306

Using a Persistent Database for Metabase's Own Metadata (Recommended for Production)

By default Metabase uses an embedded H2 database. For production, use PostgreSQL instead for better reliability:

docker run -d \
  --name metabase \
  --restart unless-stopped \
  -p 3000:3000 \
  -e MB_DB_TYPE=postgres \
  -e MB_DB_DBNAME=metabase \
  -e MB_DB_PORT=5432 \
  -e MB_DB_USER=metabase \
  -e MB_DB_PASS=CHANGE_ME \
  -e MB_DB_HOST=YOUR_POSTGRES_HOST \
  metabase/metabase:latest

Building Your First Dashboard

  1. Click New → Question to explore data visually without SQL
  2. Save questions and combine them into a Dashboard
  3. Set up automated email/Slack reports for dashboards on a schedule

Adding HTTPS

See How to Install Nginx Proxy Manager with Docker to route a domain to port 3000 with SSL.

Common Errors

Slow query performance in Metabase — ensure appropriate indexes exist on the underlying database tables Metabase queries frequently; see How to Tune MySQL/MariaDB Performance for a VPS.

Can't connect to the database — verify network connectivity and firewall rules between Metabase and the database server specifically.

Best Practices

  • Always connect with a dedicated, read-only database user — never Metabase's own admin credentials for the source data
  • Use PostgreSQL (not the default embedded database) for Metabase's own metadata in production
  • Restrict database network access to only Metabase's specific server

Continue Reading

Browse more articles in Popular Self-Hosted Applications.

  • metabase, self hosted business intelligence, data dashboard, bi tool
  • 0 Kunder som kunne bruge dette svar
Hjalp dette svar dig?

Relaterede artikler

How to Install Nextcloud on a VPS with Docker

Nextcloud is a self-hosted file sync, sharing, and collaboration platform — a...

How to Install GitLab CE on a VPS

GitLab Community Edition is a full-featured, self-hosted DevOps platform — Git repository...

How to Install Ghost CMS on a VPS

Ghost is a modern, fast, purpose-built platform for blogging and newsletters — a lighter,...

How to Set Up a Minecraft Server on a VPS

Running your own Minecraft server gives you full control over mods, plugins, and world settings....

How to Install n8n for Workflow Automation

n8n is a self-hosted workflow automation tool — connecting apps and APIs through a visual...