Metabase is open-source software for analytics and dashboards. Connect Metabase to a database, such as PostgreSQL or MySQL, and ask questions about your data: How many orders came in this month? Which products sell best? Build answers in your browser without writing SQL. If you know SQL, you can write queries directly. Turn the results into charts and dashboards that your team can view in a browser.
In this guide, we'll show you two ways to get started: the easy way, using the One-Click App, which runs Metabase with its own PostgreSQL database and HTTPS, and a manual installation with Docker Compose. Then you'll connect your first database, ask your first question, build a dashboard, and invite other people.
Metabase displays data that is already stored in a database. Metabase is a good fit for a VPS if:
- You want to analyze data from your own application, such as orders from an online store, players from a game server plugin, or sign-ups from a web app.
- Colleagues without SQL knowledge should be able to find answers themselves instead of having to ask someone who knows the database every time.
- Dashboards need to be available around the clock, so your team can view them in a browser from anywhere.
- You want to keep your data on your own server instead of sending it to a cloud analytics service.
- You want to analyze multiple databases in one place, such as a PostgreSQL and a MySQL database.
Metabase is less suitable if you want to monitor server metrics over time and receive alerts. That's what Grafana is built for. Metabase runs on Java and needs significantly more RAM than small web apps. On a VPS with very little RAM, Metabase and your database can quickly compete for resources.
The quickest way to get Metabase is through your VPS's One-Click Apps. The app installs the open-source version of Metabase along with its own PostgreSQL database, where Metabase stores its settings, questions, and dashboards. If you use a domain, Metabase is available directly over HTTPS. You don't need a reverse proxy, certificate, or firewall rules.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. For instructions, see VPS: One-Click Apps.
- Enough RAM: Plan for at least 2 GB of RAM for Metabase alone, preferably 4 GB. In our test, Metabase used around 1.7 GB of RAM immediately after starting, and the app's database used about 100 MB. Metabase says the software needs at least one CPU core and 1 GB of RAM; add one core and 2 GB of RAM for every 20 people working at the same time.
- A little over 2.5 GB of free disk space for the Metabase and PostgreSQL images, plus space for the database.
- Open your VPS in the ZapX Dashboard and go to the One-Click Apps tab.
- Search the App catalog for "Metabase" and click Install app next to Metabase.
- Use a custom subdomain or zap.cloud is already selected, with a randomly generated name. Leave the option enabled or enter a custom name, such as
metabase. You can access Metabase over HTTPS using this domain. - Under App configuration, enter the email address for your admin account in
METABASE_ADMIN_EMAIL. The default isadmin@example.com; it’s better to use your real address. This will be your Metabase username.POSTGRESQL_DATABASEis the name of the internal database (defaultmetabase). Your admin account password (SERVICE_PASSWORD_ADMIN) and the database username and password (SERVICE_USER_POSTGRESQL,SERVICE_PASSWORD_POSTGRESQL) are generated automatically. - Click Queue installation.
On its first startup, Metabase sets up its database and then creates your admin account. This takes two to three minutes. Metabase is only accessible at your address once the account exists. Until then, the app may appear to be unreachable; this is normal. You can get started as soon as the app card shows Online.
The One-Click App creates your Metabase admin account during installation. That means there’s no setup wizard for the first visitor to complete.
- Open the app settings (the gear on the app card), then go to App environment. Your sign-in email is listed under
METABASE_ADMIN_EMAIL, and your password is under Automatically generated values atSERVICE_PASSWORD_ADMIN. - Open Metabase using the Access link on the app card and sign in with these two values.
- Then change your password in Metabase: Click the gear in the top-right corner and select Account settings > Password. Your new password will be active from then on; the value under App environment will no longer work. You can also change the interface language under Account settings > Profile, including to German. The terms in this guide are from the English interface.
If you left admin@example.com in place during installation, sign in with that address. You can add a real address to your account later under Admin > People.
If you installed Metabase earlier and created your account yourself in the setup wizard, an app update won’t change it. Continue to sign in with your own credentials, not the values under App environment.
After signing in, you’ll land on the home page. Metabase includes a Sample Database with sample data that you can explore without connecting your own database. To connect your databases, follow the steps in “Connect a database and build your first dashboard” below.
The One-Click App doesn't include a mail server. Without email settings, the "I seem to have forgotten my password" link on the sign-in page won't work. Store your password in a password manager and create a second administrator account later.
Metabase runs in a Java runtime environment. Java reserves a fixed portion of your VPS's memory, even when no one is using Metabase. In our test, Metabase could use up to 1.9 GB on a VPS with 8 GB of RAM. If other memory-intensive apps are running on the same VPS, check the Monitoring tab to make sure enough memory is still available. After each restart, Metabase takes about a minute to load the interface again.
Update Metabase in the app's settings (gear icon), under App update. Click Check for updates, then install a new version with Apply update. If you see "The app is already up to date.", there isn't a newer version in the app catalog yet. Metabase itself shows the current version under Admin > Settings > Updates.
When a new version starts, Metabase automatically updates its internal database. You can only go back to the old version by restoring a backup. So back up your VPS first, for example in the Backups tab.
Accounts, questions, dashboards, and connections to your databases are stored in the app's PostgreSQL database, in the metabase-postgresql-data volume. They remain in place during updates. The data you're analyzing isn't stored in Metabase; it stays in your own databases.
The rest of this guide covers a manual installation of Metabase with Docker Compose from the command line. For example, you might use this approach on a server without One-Click Apps or if you want to run Metabase behind your own reverse proxy. The commands are written for Debian and Ubuntu.
- A Linux VPS running Debian or Ubuntu, with SSH access. See First access via SSH.
- Docker and Docker Compose (Compose v2). See Install Docker. Verify the installation with
docker --versionanddocker compose version. - A domain or subdomain whose A record points to your VPS's IP address, such as
metabase.example.com.
The following values are based on Metabase's recommendations (at least one core and 1 GB of RAM for Metabase, plus the internal database) and our test. The internal database needs little disk space unless you cache large query results.
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU core | 2 vCPU cores |
| RAM | 2 GB | 4 GB |
| Storage | 10 GB | 20 GB |
Metabase listens on port 3000 inside the container. In the Compose file below, this port is only accessible from the server itself (127.0.0.1); you'll access Metabase from outside through the reverse proxy. With ufw, allow only SSH and the ports needed for the reverse proxy:
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
For more on the firewall, see VPS: Open ports and manage the firewall on Linux.
Create a directory and generate two random values: one for the internal database password and one for encrypting stored credentials:
sudo mkdir -p /opt/metabase
cd /opt/metabase
printf 'POSTGRES_PASSWORD=%s\nMB_ENCRYPTION_SECRET_KEY=%s\n' "$(openssl rand -hex 24)" "$(openssl rand -base64 32)" | sudo tee .env > /dev/null
sudo chmod 600 .env
Then create the docker-compose.yml file, for example with sudo nano docker-compose.yml:
services:
metabase:
image: metabase/metabase:v0.65.4.4
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
ports:
- "127.0.0.1:3000:3000"
volumes:
- /dev/urandom:/dev/random:ro
environment:
MB_DB_TYPE: postgres
MB_DB_HOST: postgres
MB_DB_PORT: 5432
MB_DB_DBNAME: metabase
MB_DB_USER: metabase
MB_DB_PASS: ${POSTGRES_PASSWORD}
MB_ENCRYPTION_SECRET_KEY: ${MB_ENCRYPTION_SECRET_KEY}
JAVA_TIMEZONE: Europe/Berlin
healthcheck:
test: ["CMD-SHELL", "curl -fs http://127.0.0.1:3000/api/health || exit 1"]
interval: 10s
timeout: 5s
retries: 30
start_period: 120s
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: metabase
POSTGRES_USER: metabase
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U metabase -d metabase"]
interval: 5s
timeout: 5s
retries: 10
The most important lines:
imagespecifies a fixed version. Find the current version number on Docker Hub. Use a fixed version instead oflatestso you can decide when to update.MB_DB_*connects Metabase to the PostgreSQL container. Without these lines, Metabase stores everything in a built-in H2 file, which Metabase says isn't intended for permanent use.MB_ENCRYPTION_SECRET_KEYencrypts the credentials for your databases that Metabase stores. Keep this value safe: if you lose it, you'll have to re-enter all your database connections.JAVA_TIMEZONEsets the time zone for your analytics.127.0.0.1:3000:3000makes Metabase accessible only from the server itself.
Start Metabase:
sudo docker compose up -d
sudo docker compose ps
The first start takes one to two minutes. Once metabase shows as healthy, Metabase is ready. View errors with sudo docker compose logs -f metabase.
Port 3000 isn't accessible from outside. To make sure no one completes the setup wizard before you, create the admin account through an SSH tunnel before setting up the reverse proxy. Run this command on your PC:
ssh -L 3000:127.0.0.1:3000 root@SERVER_IP
Then open http://localhost:3000 in your browser. You’ll see the “Welcome to Metabase” page. With a manual installation, you create your admin account yourself in the setup wizard, and whoever completes it first becomes the administrator:
- Click Let's get started.
- Under “What should we call you?”, enter your first and last name, your Email, your team’s name under Company or team name, and a long, secure password twice.
- Click Next. Metabase creates your administrator account as soon as you click this.
- Answer “What will you use Metabase for?”, connect a database under Add your data or skip this step, and choose under Usage data preferences whether Metabase can send anonymous usage data to the developer.
You can close the tunnel afterward.
For ongoing access, route a domain to Metabase through nginx. For instructions on installing nginx, see VPS: Set up an nginx reverse proxy on Linux. Create the /etc/nginx/sites-available/metabase file:
server {
listen 80;
server_name metabase.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 300s;
}
}
proxy_read_timeout gives long-running queries more time before nginx closes the connection. Enable the site and get a certificate:
sudo ln -s /etc/nginx/sites-available/metabase /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d metabase.example.com
For more about Let's Encrypt, see VPS: Create an SSL certificate (Let's Encrypt) for Linux servers. Then check in Metabase under Admin > Settings > General that your HTTPS address is listed under Site url. Metabase uses it for links in emails.
Everything you create in Metabase is stored in the PostgreSQL database. Back it up regularly with pg_dump:
cd /opt/metabase
sudo mkdir -p /root/backups
sudo docker compose exec -T postgres pg_dump -U metabase -Fc metabase > /root/backups/metabase-$(date +%F).dump
Also back up the .env file. Without the MB_ENCRYPTION_SECRET_KEY value, Metabase won't be able to read your stored database credentials after a restore. Regularly download the backups from the server, for example via SFTP.
- Back up the database as described above.
- In
docker-compose.yml, enter the new version number forimage. - Download the new image and restart:
sudo docker compose pull
sudo docker compose up -d
When it starts, Metabase updates the internal database automatically. Before making a major version jump, read the upgrade notes. The easiest way to go back to an older version is to restore the backup you made beforehand.
These steps are the same for the One-Click App and the manual installation.
Metabase recommends creating a dedicated database user that can only read your tables. This way, even a poorly constructed query can't change or delete anything. For PostgreSQL, for example, create one with psql (in pgAdmin, run the same commands in the Query Tool for the shop database, but omit the \c shop line):
CREATE ROLE metabase_read LOGIN PASSWORD 'CHANGE_ME';
GRANT CONNECT ON DATABASE shop TO metabase_read;
\c shop
GRANT USAGE ON SCHEMA public TO metabase_read;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO metabase_read;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO metabase_read;
For MySQL and MariaDB:
CREATE USER 'metabase_read'@'%' IDENTIFIED BY 'CHANGE_ME';
GRANT SELECT ON shop.* TO 'metabase_read'@'%';
Replace shop with the name of your database.
The PostgreSQL and MariaDB One-Click Apps expose their ports on your VPS. Metabase can therefore connect to them using your VPS's IP address, and the connection stays on the VPS.
- Click the gear icon (Settings) in the top-right corner and select Admin. Open Databases and click Add database.
- Under Database type, select PostgreSQL. For MariaDB, select MySQL; both use the same driver.
- Enter the connection details:
| Field | What to enter |
|---|---|
| Display name | A name for the database in Metabase, such as "Shop" |
| Host | Your VPS's IP address |
| Port | 5432 for PostgreSQL, 3306 for MariaDB, or the configured port |
| Database name | The name of your database |
| Username and Password | A user with read-only access |
- Click Save. Metabase will then scan the tables. This can take a few minutes for large databases.
The database app credentials are in its settings (gear icon), under App environment > Automatically generated values. If your database is on another server, enable Use an SSH-tunnel in the form. The database port doesn't need to be open there.
If Metabase is running on the same VPS, the database port doesn't need to be accessible from the internet. Restrict access to it in your VPS's Network firewall tab to the IP addresses that actually need to connect. For instructions, see VPS: Open ports and manage the firewall on Linux.
- Click New > Question in the top-right corner.
- Under "Pick your starting data", select your database and a table, such as
orders. - Narrow down the data under Filter, for example to the last 30 days, and summarize it under Summarize, such as "Count" grouped by day.
- Click Visualize. Metabase selects a suitable chart, which you can change under Visualization.
- Save the question with Save.
If you know SQL, select New > SQL query instead and write the query yourself. To get a quick overview of a table, use an X-Ray: Metabase suggests ready-made analytics on the home page that you can keep on a dashboard with Save this.
Create a dashboard with New > Dashboard and add your saved questions. Drag the cards to arrange them, and add filters, such as a date range, that apply to all cards. Dashboards and questions are stored in Collections. All users can see the Our analytics collection; only you can see Your personal collection.
Invite other people under Admin > People by clicking Invite someone. Without email settings, Metabase will show you a temporary password to send to the person yourself. With a mail server configured under Admin > Settings > Email, Metabase sends invitations and password links automatically.
Create groups under Groups, for example, "Sales". The Administrators and All Users groups are always available. Under Admin > Permissions, choose which databases and collections each group can access.
New users are automatically added to All Users. Give this group only the permissions that everyone should have, and use custom groups to grant additional access.
- No live monitoring: Metabase is built for analytics. Grafana is a better choice for server metrics, alerts, and time series.
- Database load: Each question runs a query on your database. Large dashboards on a heavily used database can noticeably slow it down.
- Open-source edition: Features such as SAML single sign-on and row-level permissions are part of Metabase's paid editions and aren't included in the One-Click App.
- No mail server: Email invitations, password links, and scheduled reports by email only work with your own SMTP server.
With Metabase, you can now ask questions of your databases, build dashboards, and share insights with your team, secured by a dedicated read-only user. To go with it, the guide Set Up pgAdmin on a Linux Server shows you how to manage your PostgreSQL databases conveniently in your browser.
If you have any other questions or need help, our support team is available every day! 🙂
