How to Set Up Metabase for Self-Hosted Analytics
Last updated Apr 9, 2026

What Metabase Does and Why It Matters
Metabase is an open-source analytics platform used by over 60,000 organizations worldwide. It connects directly to your database and lets anyone on your team ask questions about the data through a visual interface, without writing SQL. You install it on your own server, which means your data never leaves your infrastructure.
For ops managers, analysts, and founders working with data stored in PostgreSQL, MySQL, or similar databases, Metabase fills the gap between raw database access and expensive BI platforms like Tableau or Power BI. The open-source edition is completely free. The paid Pro and Enterprise tiers add row-level permissions and embedded analytics, starting at roughly $6,500 per year for the Pro plan (based on 2026 pricing).
Prerequisites
Before you start, you need three things. First, a server or local machine with at least 2 GB of RAM and Docker installed, or Java 11+ if you prefer the JAR method. Second, network access from that machine to the database you want to analyze. Third, read-only credentials for your target database. Using a read-only user is important because it prevents Metabase from accidentally modifying production data.
If you do not have Docker installed, the official Docker documentation at docs.docker.com covers installation for every major operating system. On most Linux distributions, the process takes under five minutes.
Step 1: Install Metabase with Docker
Run this single command to pull and start Metabase:
docker run -d -p 3000:3000 \
--name metabase \
-v metabase-data:/metabase.db \
metabase/metabase
The -v metabase-data:/metabase.db flag mounts a persistent volume so your configuration survives container restarts. Without it, you lose all saved questions and dashboards when the container stops. This is the single most common mistake in Metabase setup guides that only show the basic one-liner.
If you prefer the JAR method instead of Docker:
java --add-opens java.base/java.nio=ALL-UNNAMED -jar metabase.jar
Both methods expose the web interface on port 3000. Open http://your-server-ip:3000 in your browser to continue.
Step 2: Complete the Initial Setup Wizard
When you first load the interface, Metabase presents a setup wizard with five steps. Set your preferred language, create your admin account (use a strong password and store it in your password manager), then choose whether to add your database now or later.
Select "Add my data" and choose your database type from the dropdown. Metabase supports PostgreSQL, MySQL, MariaDB, MongoDB, SQLite, SQL Server, BigQuery, Snowflake, Redshift, and several others. Enter the hostname, port, database name, and your read-only credentials.
Click "Connect database" and Metabase will scan your schema. Depending on the number of tables, this scan takes anywhere from a few seconds to a few minutes. Once complete, Metabase auto-generates metadata about your tables, which powers the visual query builder later.
Step 3: Ask Your First Question
Metabase calls queries "questions." Click the "+ New" button in the top navigation and select "Question." You will see three options: a visual editor (Simple question), a notebook-style builder, and a native SQL editor.
For your first question, use the Simple question mode. Select a table, add a filter (for example, orders from the last 30 days), pick a summarization (count, sum, average), and group by a column like date or category. Click "Visualize" to run the query.
The result appears as a table by default. Click the "Visualization" button to switch between bar charts, line charts, pie charts, maps, and other formats. Metabase picks a reasonable default based on your data shape, but you can always override it.
Save the question by clicking "Save" in the top right. Give it a descriptive name like "Monthly Order Count by Category" rather than something vague like "Query 1." Good naming becomes critical once your team has dozens of saved questions.
Step 4: Build Your First Dashboard
Click "+ New" and select "Dashboard." Give it a name like "Operations Overview" or "Sales KPIs." Then click the pencil icon to enter edit mode.
Click the "+" icon inside the dashboard to add your saved question. You can resize and reposition each card by dragging. Add text cards for context, filter widgets at the top for interactivity, and additional saved questions as you create them.
The most useful dashboard pattern for operational teams is a date filter at the top connected to three or four key metric cards, with one or two trend charts below. This layout gives your team a single screen they can check daily without running any queries manually.
Click "Save" when the layout looks right. Share the dashboard by copying its URL or by setting up a public link under "Sharing."
Step 5: Switch from H2 to PostgreSQL for Production
By default, Metabase stores its own application data (saved questions, dashboards, user accounts) in an embedded H2 database. H2 works fine for evaluation and single-user setups, but it cannot be shared between multiple Metabase instances, and it is slower under concurrent use.
For any team deployment, migrate to a PostgreSQL application database. Set these environment variables before starting Metabase:
docker run -d -p 3000:3000 \
--name metabase \
-e MB_DB_TYPE=postgres \
-e MB_DB_DBNAME=metabase_app \
-e MB_DB_PORT=5432 \
-e MB_DB_USER=metabase \
-e MB_DB_PASS=your_secure_password \
-e MB_DB_HOST=your-postgres-host \
metabase/metabase
If you already have data in H2 that you want to keep, Metabase provides a migration command: java -jar metabase.jar load-from-h2 /path/to/metabase.db. Run this before switching over.
Step 6: Set Up Permissions and Teams
Under Admin > People, invite team members by email. Metabase organizes permissions by groups. Create groups that match your org structure: "Marketing," "Operations," "Finance," and so on.
Under Admin > Permissions, assign each group access to specific databases and tables. The three levels are "Can view" (run queries and see dashboards), "Can curate" (organize and manage collections), and "No access." Start with the principle of least privilege. Give most groups "Can view" access only to the tables they need.
For sensitive data like salary information or customer PII, use table-level permissions to restrict access. This is one area where Metabase's open-source edition handles the basics well, but the Pro edition adds row-level sandboxing for more granular control.
Common Mistakes to Avoid
Running Metabase without a persistent volume is the number one issue. The second most common problem is pointing Metabase at a production database user with write access. Always use read-only credentials.
Third, skipping the H2-to-PostgreSQL migration for team deployments leads to data loss risk and performance problems once you have more than two or three concurrent users.
Fourth, forgetting to set up HTTPS. If your Metabase instance is accessible over the internet, put it behind a reverse proxy like Nginx or Caddy with TLS enabled. Metabase itself does not handle SSL termination.
When Metabase Fits and When It Does Not
Metabase works best when your data already lives in a structured database and your team needs a way to explore it without writing code. It handles reporting, dashboards, and ad-hoc questions well.
It is less suited for unstructured data analysis (think messy CSVs, PDFs, or multi-format files that need cleaning before analysis). If your workflow starts with raw files rather than a database, a tool like VSLZ AI can handle the cleanup and analysis from a file upload with no database setup required.
Metabase also does not include built-in ETL or data pipeline features. You will need a separate tool like Airbyte, Fivetran, or dbt to move and transform data before it reaches Metabase.
Summary
Install Metabase with Docker using a persistent volume. Connect a read-only database user. Build questions with the visual editor and assemble them into dashboards. Migrate the application database from H2 to PostgreSQL before inviting your team. Set up permissions by group, and put the instance behind HTTPS if it faces the internet. The entire process from install to first shared dashboard takes under an hour.
FAQ
Is Metabase really free for commercial use?
Yes. The Metabase open-source edition is released under the AGPL license and is free for commercial use, including self-hosting for your entire team. The Pro edition ($6,500/year as of 2026) adds row-level permissions, embedded analytics, and priority support. The Enterprise edition offers additional security and compliance features with custom pricing.
What databases does Metabase connect to?
Metabase supports PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB, BigQuery, Snowflake, Amazon Redshift, Databricks, Presto, Druid, ClickHouse, and several others through community drivers. The full list is available in the Metabase documentation under Database Drivers.
How much RAM does Metabase need to run?
Metabase recommends a minimum of 2 GB of RAM for small teams (under 10 users). For teams of 10-50 concurrent users, 4-8 GB is more appropriate. The JVM heap size defaults to 2 GB but can be adjusted using the JAVA_OPTS environment variable. Memory usage scales primarily with the number of concurrent queries and the complexity of your dashboards.
Can I use Metabase without knowing SQL?
Yes. Metabase includes a visual query builder called Simple Question mode that lets you select tables, apply filters, choose aggregations, and group results without writing any code. For more complex queries, the notebook editor provides a drag-and-drop interface for joins and custom expressions. SQL mode is available for advanced users but is not required.
How do I migrate from the default H2 database to PostgreSQL?
Stop your Metabase instance first. Run the migration command: java -jar metabase.jar load-from-h2 /path/to/metabase.db with the MB_DB_TYPE, MB_DB_HOST, MB_DB_DBNAME, MB_DB_USER, and MB_DB_PASS environment variables pointing to your new PostgreSQL instance. The command copies all application data (saved questions, dashboards, users) to PostgreSQL. Once complete, restart Metabase with the PostgreSQL configuration and verify your data is intact.


