Running Metabase as a systemd service behind Nginx

A practical plan for installing the Metabase JAR on a Linux VM as a systemd service behind Nginx, covering the service user, environment file, Java runtime and checks before go-live.

On this page

Running Metabase as a systemd service behind Nginx: when a VM is the right host

A systemd unit and an Nginx reverse proxy in front of the Metabase JAR give an infrastructure team a plain Linux service it can patch, monitor and restore with the tools it already runs. This pattern suits teams that want Metabase on a virtual machine they control rather than inside a container platform. The Metabase systemd guide sets up four pieces: an unprivileged user that owns the process, an environment file holding configuration and secrets, a service unit that starts and restarts the JAR, and an Nginx proxy that accepts browser traffic and forwards it to the application. Choose this route when your organization already manages VMs with configuration management, when auditors expect host-level logs and access controls, or when no container platform is available. Docker or Kubernetes make more sense when you already operate those platforms well, need rapid horizontal scaling, or want image-based rollbacks as a standard practice.

Metabase's open source edition is licensed under the AGPL (LICENSE-AGPL.txt in the repository), and its commercial editions fall under the Metabase Commercial Software License. Confirm with your legal team which edition and license terms apply before you copy the JAR onto a host, and record that decision in the deployment design. The backend is written in Clojure and Java and runs as a JAR, so the host needs a supported Java runtime. Confirm the exact Java version required for the Metabase release you plan to install in the Metabase GitHub repository and in the release notes, then decide who owns runtime patching, since a JVM update is a separate change from a Metabase upgrade.

Before the first install, decide who owns each layer: the operating system, the Java runtime, the Nginx configuration and TLS certificates, the environment file and its secrets, and the application database. The VM approach leaves all of these with your team, so the cost and effort sit in ongoing operations rather than in a platform fee. Plan for a PostgreSQL application database rather than the embedded H2 database, which Metabase provides for demos, and plan the backup and upgrade routine before go-live. A partner can write the unit file, proxy configuration and runbook for your environment, but your team should be able to restart the service and roll back an upgrade without outside help.

Configuration choices and when each fits

This table compares the host-level choices for a systemd and Nginx Metabase install: application database, environment file location, TLS termination and restart policy. Read each row against your environment, then use the right-hand column to decide which option fits a pilot and which fits production.

DecisionOptionWhen it fits
Application databaseEmbedded H2 fileDemos and short evaluations only. Metabase ships H2 for demos and recommends PostgreSQL for production, so plan a migration before users depend on the instance.
Application databaseExternal PostgreSQLProduction. Metabase recommends PostgreSQL, and the instance can be backed up and restored independently of the host.
Application databaseExternal MySQL or MariaDBProduction where your team already runs MySQL 8.4.0 or MariaDB 10.6.0 or later with utf8mb4. Confirm the character set before install.
Environment file locationRoot-readable file in /etc, owned by root and read by the service userProduction. Keeps database credentials and the encryption key out of the unit file and out of shell history.
Environment file locationUnit file Environment= linesOnly for throwaway test hosts. Secrets are visible to anyone who can read the unit definition.
TLS terminationNginx on the same host with TLS, Metabase bound to localhostSingle-VM installs where the JAR port should not face the network. Set the site URL to the HTTPS address users type.
TLS terminationUpstream load balancer or WAF terminates TLSInstalls behind an existing edge service. Confirm forwarded headers reach Nginx and Metabase, and restrict direct access to the JAR port.
Restart policysystemd Restart=on-failure with a service userProduction. Restarts the JAR after a crash without running it as root, and leaves a clean stop for planned upgrades.
Restart policyManual start from a shell or screen sessionNot suitable for shared use. The service stops on reboot or logout and produces no supervised restarts.

How to install and start the Metabase service

This sequence takes a Linux VM from a bare host to a Metabase JAR running as a supervised, unprivileged service that answers through an Nginx reverse proxy. Each step ends with a check so you know the layer below works before you add the next one.

  1. Install a supported Java runtime

    Install the Java runtime version that the Metabase installation documentation specifies for the release you plan to run, using your distribution's packages or a vendor build your security team approves. Confirm the Java version is the one the service will use by running the version command as the same user and path the unit file will use. Check: the version output matches the requirement for your chosen Metabase release, and the path to the binary is recorded for the unit file.

  2. Create an unprivileged service user

    Create a system account with no login shell and no home directory privileges beyond what Metabase needs, for example a dedicated metabase user and group. Keep it separate from administrator accounts so the process cannot change system files. Check: id metabase returns the user and group, and sudo -u metabase bash is refused because the shell is disabled.

  3. Place the JAR and set ownership

    Create an application directory such as /opt/metabase, download the JAR for your chosen release from the official Metabase source, and verify its checksum against the value published with that release. Copy the file into the directory and set ownership to the service user so Metabase can read the JAR and write its plugin and log locations. Check: ls -l shows the owner and group as metabase, and the checksum matches.

  4. Write the environment file

    Create an environment file, for example /etc/metabase/metabase.env, that holds the application database connection settings and the site settings your deployment requires. Restrict the file to root ownership with group read for the service user, and keep secrets out of the unit file itself. Plan to move the embedded H2 application database to PostgreSQL before production use, using the one-time move described in the migration guide. Check: the file mode is restricted, and no secret appears in a world-readable location.

  5. Define the systemd unit

    Write a unit file such as /etc/systemd/system/metabase.service that runs the Java binary against the JAR as the metabase user, loads the environment file, sets a restart policy and orders the service after the network and database are available. Run systemctl daemon-reload so systemd reads the new unit. Check: systemd-analyze verify metabase.service reports no errors.

  6. Start the service and confirm it is listening

    Enable and start the unit with systemctl enable --now metabase, then follow the journal until Metabase reports that it has started. Confirm the process runs as the metabase user and that it listens on the local port set in your configuration. Check: systemctl status metabase shows active, and a local request to the port returns the Metabase setup or sign-in page.

  7. Configure the Nginx reverse proxy

    Add a server block that forwards HTTP requests from the public host name to the local Metabase port and passes the original host and scheme headers. Test the configuration before reloading, then reload Nginx. TLS termination and HTTPS redirects are covered in the reverse proxy guide, so confirm those settings there. Check: nginx -t passes, and a request through the host name reaches the same page that the local request returned.

  8. Verify the full path and restart behavior

    Test a request end to end through Nginx, confirm the sign-in page loads, and restart the service once to confirm it comes back unattended. Review the journal for startup errors before handing the instance to users. Check: the proxied request succeeds after a restart, and no database or permission errors appear in the logs.

Host choices by team and environment

A small internal instance usually runs on one VM that a single platform or IT team owns, serving a limited group of analysts. The core steps stay the same as in the production guide: an unprivileged service user, an environment file, a unit file and an Nginx proxy in front of the JAR. The decisions that change are mostly about how much hardening you need to document, not about whether the service runs.

  • File permissions: Keep the JAR and the environment file owned by root or a deployment user, readable by the service account, with the service account unable to rewrite its own binary.
  • Secret handling: Store the encryption key and database password in the environment file with restrictive permissions rather than in the unit file, which may be readable by more users.
  • Log location: Use journalctl for day-to-day reading, and confirm where the Metabase log output goes before relying on it for troubleshooting.
  • Proxy settings: Bind Metabase to localhost and let Nginx accept outside connections, so the application port is not reachable from the network.

Before you go live, confirm that the service restarts after a reboot and that the environment file is not readable by ordinary users on the host.

Security and operations for the systemd and Nginx host

Six controls sit around the Metabase JAR on this host: the process identity, the secrets file, the network path to the port, TLS at the proxy, patching, and visibility into logs. Each one is a separate decision, and each has a check you can repeat after every change. The cards below cover what to set and what to verify.

Run as an unprivileged user

The service should run under a dedicated system account with no login shell and no sudo rights, owning only the Metabase install directory and its data path. Confirm that the account cannot write to the JAR location and that the unit does not run as root. If Metabase is compromised, a narrow account limits what the attacker can change on the VM. Ask your team to review the account's file ownership after every upgrade, because package or script changes can quietly reset it.

systemd guide

Protect the environment file and secret key

The environment file usually holds the application database password and the Metabase encryption secret key. Keep it owned by root, readable only by the service account, and out of version control and shell history. Losing or changing the encryption key can make stored database credentials unreadable, so record where the key is backed up before you need it. Check file permissions with a listing after each change, and rotate the database password through a planned restart.

Restrict direct access to the Metabase port

Metabase listens on its own HTTP port, and clients should reach it only through Nginx. Bind the application to the loopback interface or block the port at the host firewall so that users cannot skip the proxy and its TLS and header rules. Test from another machine on the same network that the application port does not answer. Also confirm that the application database port is reachable only from the Metabase host.

TLS and forwarded headers at Nginx

Nginx should terminate TLS, redirect plain HTTP to HTTPS, and pass the original host and protocol headers to Metabase so that links, cookies and redirects use the public address. Confirm the Metabase site URL matches the public name, and that HSTS and modern TLS settings are set in the Nginx configuration. Review the certificate renewal path, since an expired certificate will stop all users at once. The reverse proxy topic covers the exact settings.

Patch Java and Metabase on a schedule

Two components need patching: the Java runtime on the VM and the Metabase JAR. Track Metabase's version support dates so that you move to a supported LTS line before end of life, and back up the application database before each upgrade because migrations run automatically at startup. Keep the previous JAR so that a rollback is possible. Ask your vendor or internal team who receives Java security updates and how quickly the VM is rebooted or restarted after them.

LTS support window
14 months
Metabase version support

Logs and monitoring for the service

Use journald to read the unit's output with journalctl -u metabase, and forward Nginx access and error logs to the same place your security team watches. Alert on repeated failed logins, service restarts, certificate expiry and disk use on the data path. Confirm that log files do not capture passwords or tokens from requests. Metabase's own monitoring options are covered in the operations topic, and this host-level view should exist even if you add them later.

How requests reach Metabase through Nginx and systemd

A user's browser opens an HTTPS connection to Nginx on the VM, which terminates TLS and forwards the request to the Metabase JAR listening only on localhost. systemd starts and supervises that process and loads its environment file, and Metabase reads and writes its application database over the network to an external PostgreSQL server. Check the trust boundary at the Nginx listener, confirm the JAR is not reachable from outside the VM, and confirm the database connection is restricted to the Metabase host.

Requests cross the public boundary only at Nginx, and Metabase reaches its database from inside the VM.

Questions teams ask before running Metabase on a VM

Can our team install and run Metabase on a VM without outside help?

Yes, many teams do. The work is a JAR, a Java runtime, a dedicated service user, an environment file, a systemd unit and an Nginx proxy, all of which a Linux-capable team can build from Metabase's systemd guide. The questions to settle honestly are whether someone on the team can own TLS renewal, Java patching, database backups and upgrades over the life of the instance. If those tasks have no clear owner, a partner can help with the build and the handover, but the ongoing ownership stays with you either way.

What makes this setup harder or easier to build?

The main effort drivers are Linux and Java experience, how many certificate and DNS changes your network team controls, whether you already run PostgreSQL for the application database, and how formal your change process is. Teams that stay on the embedded H2 database for production take on more risk, because Metabase recommends PostgreSQL for production and documents a load-from-h2 path to move later. Ask for the choice of database and TLS approach to be written into the scope before the build starts.

What does the work need from our team before it starts?

Plan for access to the target VM with sudo rights during the build, a DNS record for the Metabase hostname, a TLS certificate or the approved process to issue one, outbound access to the data sources Metabase will query, and a PostgreSQL instance or database role for the application database. You will also need to name an owner for secrets, such as the environment file contents, and for the backup location. Confirm each item with your network, identity and database teams before scheduling the build.

How do upgrades fit into a systemd and Nginx deployment?

Upgrades replace the JAR and restart the service, and Metabase runs application database migrations automatically when it starts. Because of that, the first step is always a backup of the application database, which Metabase recommends before any upgrade. For major upgrades, the docs advise reducing a cluster to a single node because of a migration lock, and upgrading one release at a time when moving from versions older than 40. Rollback is either a restore of the pre-upgrade backup, which the docs recommend, or running the migrate down command with the newer JAR. Check the Metabase upgrading guide before each change window.

Which Metabase version should we pin on a new VM?

Choose a version with a support window that matches your change cycle. Metabase LTS versions receive support for 14 months, while non-LTS versions usually reach end of life after about 2 months. Metabase 64 is an LTS release with end of life on 1 December 2027, according to Metabase's version support page. Confirm the current LTS and end-of-life dates on that page on the day you install, because newer releases may have shipped since this page was written.

Do we need a paid plan to use SSO with this setup?

Open Source and Starter support Google sign-in and LDAP, but JWT, OIDC, SAML, advanced LDAP group and attribute sync and SCIM provisioning require the Pro or Enterprise plan. According to Metabase's pricing page, SSO is included only in Pro and Enterprise. Pro is listed at $575 per month or $517.50 per month billed yearly, with the first 10 users included. Enterprise is priced by quote, starting at $20,000 per year. Nginx and systemd do not change this boundary, so check the plan before designing the login flow.

What does a fixed-scope engagement for this setup cover?

A fixed-scope engagement is agreed in writing before work starts. DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure, so a typical scope for this page would list the VM and OS, the service user and file layout, the environment file and secret handling, the systemd unit, the Nginx proxy and TLS, the Java runtime, the application database connection, the backup procedure and a handover document. Ask for the scope, deliverables and timeline in writing, and ask what is excluded, such as data source connections or SSO configuration. DeployOpen does not publish a price list, so the quote follows from the written scope.

Does DeployOpen certify that our Metabase setup meets a compliance framework?

No. DeployOpen prepares systems, controls and evidence for compliance assessments, including documentation of access, logging and backup procedures. Independent auditors and certification bodies issue any audit report, attestation or certification. For a VM-based Metabase, ask your assessor which evidence they need, such as the systemd unit, the Nginx configuration, backup records and the upgrade log, and agree that evidence list before the build.

Limits to confirm in your environment

A systemd and Nginx install is only as current as the versions underneath it. The items below are the limits that change between releases and between your standards and your hosts, so confirm each one against the release you plan to run before you write the unit file or the proxy config.

Java runtime version

The Java runtime is the first thing a Metabase JAR needs, and the required version depends on the release you choose. Check the Java version stated for your target release in the Metabase documentation, then confirm your OS packages provide that exact runtime. Record the path to the java binary that the ExecStart line in the unit file will call, so a later OS update does not silently change it.

systemd guide

Application database versions

Metabase supports PostgreSQL for production, and it also supports MySQL and MariaDB under specific minimum versions. Confirm that the database version your team runs or is willing to run appears in the supported list for your release. A database that is out of support for your standards can block the install even when Metabase itself starts.

Application database docs

LTS and end-of-life dates

Pick the release line before you build the unit file, because the support window determines how often you must upgrade. LTS releases receive support for 14 months, while non-LTS releases usually reach end of life after 2 months. Look up the end-of-life date for your chosen release and place the next upgrade on your change calendar.

Version support page

OS and Nginx support status

Your Linux distribution and Nginx package must be supported by your own standards, such as the vendor support lifecycle your security team accepts. Confirm the distribution release, the Nginx version and the TLS library they link against. Metabase does not certify these host components, so the check belongs to your platform team.

SSO features and paid plans

SAML, OIDC, JWT, SCIM and advanced LDAP group sync need the Pro or Enterprise plan, while Google sign-in and basic LDAP work on Open Source. If your Nginx front end is meant to carry an SSO flow, confirm the plan before you design the reverse proxy headers. Ask the vendor to confirm current plan terms in writing, because plan contents change.

People and groups docs

How upgrades change a systemd deployment

Upgrading a systemd deployment means replacing the Metabase JAR file and letting Metabase run its application database migrations on first start. Those migrations change the schema in place, so take a backup of the application database before you touch the JAR. In this layout the JAR path and version usually live in the systemd unit's ExecStart line and the environment file, so a typical upgrade stops the service, keeps the previous JAR under a versioned name, copies the new JAR into place, and starts the service again. Confirm the exact steps against the upgrade guide for the release you are moving to, since the documented sequence applies to any installation method.

Rollback has two documented paths. The recommended path is to stop the service, restore the pre-upgrade application database backup, and start the previous JAR. The alternative is to run the migrate down command with the newer JAR, which reverses migrations without restoring data. Test whether your restore procedure works on a copy before the production upgrade, because a backup you have never restored is an assumption, not a rollback plan. Keep the previous JAR on disk until the new version has run cleanly through your checks, and record which Metabase version last wrote to the application database.

If you run more than one Metabase node against a shared application database, major upgrades require reducing the cluster to a single node first because of a migration lock. In a single systemd VM this step is simple but easy to forget when the instance was scaled out later. Check the version support and upgrade pages before you plan the window, and read the upgrade planning guidance for Metabase for the release path, including the advice to upgrade one release at a time from versions older than 40. For the broader process, including release channels and testing, see the Metabase upgrades content group.

How DeployOpen scopes and delivers this deployment

DeployOpen plans and builds the Metabase JAR on a Linux VM you control, with a dedicated unprivileged service account, an environment file, a systemd unit and an Nginx reverse proxy in front of it. Each step is written down so your operations team can run, patch and upgrade the instance without depending on us.

How we scope

  • Written scope covers the target VM, operating system, Java runtime, and the Metabase version to install.
  • Scope names the PostgreSQL application database connection, or confirms whether the H2 demo database is excluded.
  • Scope lists the Nginx hostname, certificate source, and which SSO or LDAP options are in or out.

How we build

  • We create the unprivileged Metabase service user, file ownership, and a restricted directory for the JAR and config.
  • We write the environment file, the systemd unit with restart behavior, and the Nginx proxy configuration with forwarded headers.
  • We test service start, stop, reboot recovery, log output, and a login through the proxy before the handover checklist is signed off.

How we hand over

  • You receive the documented file layout, unit file, environment file keys, and Nginx configuration, with the reasons for each setting.
  • Runbooks cover restarts, log locations, the application database backup step, and the steps to roll back an upgrade.
  • We walk your team through the upgrade procedure so later version changes can follow the same controlled path.

How we support

  • Ongoing support, upgrades, and continuous testing are available as a retainer, scoped separately from the build.
  • Retainers can cover Metabase version updates, Java runtime patching, and Nginx certificate renewal checks.
  • Ask for a fixed-scope quote with named deliverables, and confirm which operating system and Java versions your standards allow.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.