Say Hi

Hassle-free Metabase Setup using Systemctl

July 23, 2023

Metabase is an open source business intelligence tool that allows users to ask questions about their data and get answers in the form of charts and tables.

In this article, we’ll see how to setup Metabase using systemctl which is a Linux service manager that allows you to start, stop, restart, and check the status of a service. It is built-in to most Linux distributions.

Before we begin, make sure you have a Linux server with root access and Java version 8 or higher installed on your machine.

Download Metabase

First things first, let’s create a directory where we will be installing Metabase. I am going to place it at /home/data/tools/metabase but you can choose any directory of your choice.

sudo mkdir -p /home/data/tools/metabase

Now let’s download the latest version of metabase from the official website.

cd /home/data/tools/metabase
wget https://downloads.metabase.com/v0.45.3/metabase.jar

Create a Systemd Service

Create and open the file /etc/systemd/system/metabase.service in your favorite editor and add the following content.

[Unit]
Description=Metabase server
After=syslog.target
After=network.target

[Service]
WorkingDirectory=/home/data/tools/metabase
ExecStart=/usr/bin/java -jar /home/data/tools/metabase/metabase.jar
Environment=MB_JETTY_PORT=2812
User=root
Type=simple
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=metabase
SuccessExitStatus=143
TimeoutStopSec=120
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Make sure to replace the WorkingDirectory and ExecStart with the directory where you have placed the Metabase jar file. Also, make sure to change the MB_JETTY_PORT to the port you want to use.

Next, let’s reload systemd, enable the service and start our metabase server. Run the following commands.

sudo systemctl daemon-reload
sudo systemctl enable metabase.service
sudo systemctl start metabase.service

It is going to take a few seconds to start the server. You can check the status and the logs of the service by running the following command.

sudo journalctl -u metabase -b -f

Once it is up and running, you can access it by visiting http://<your-server-ip>:2812 in your browser.

Conclusion

In this article, we have seen how to setup Metabase using systemctl. We have also seen how to check the status and the logs of the service. I hope you found this article helpful. Stay tuned for more articles like this.