Install Metabase with Systemd on Debian 10 / Debian 9

Metabase is a simple and powerful analysis tool that anyone can use to learn and decide on company data. No technical knowledge is required to get started with the tool. In this guide, I will show you how to install Metabase using Systemd on Debian 10 / Debian 9 Linux systems.

For Ubuntu, please check: How to install the metabase using Systemd on Ubuntu

To run Metabase jar files, you need to have Java installed on your system. Currently, Metabase requires Java 8 or higher and can run on OpenJDK or Oracle JDK.

Step 1: Install Java on Debian

Update your Debian machine:

sudo apt -y update
sudo apt -y upgrade
sudo reboot

Then install Java 8 or Java 11 in the base operating system.

Install OpenJDK 11 – Debian 10

sudo apt -y install openjdk-11-jdk openjdk-11-jre

Install OpenJDK 8 Debian 9

sudo apt -y install openjdk-8-jdk openjdk-8-jre

When prompted to accept the license agreement, please answer “Yes”

Verify that Java is installed and running.

$ java -version
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Debian-1deb10u1, mixed mode, sharing)

Step 2: Install and configure the database server (MariaDB)

If you have configured a data store for Metabase, you can skip this step. In this lab, we will use the MariaDB database server set up with the following guidelines.

Install MariaDB on Debian

Other database installation guidelines are:

Install MySQL 8 on Debian

Install PostgreSQL on Debian

I will create a database for Metabase on the MySQL database server shown below.

Login to MySQL Shell as root

$ mysql -u root -p

Create a database and user with access:

CREATE DATABASE metabase;
GRANT ALL PRIVILEGES ON metabase.* TO 'metabase'@'localhost' IDENTIFIED BY "StrongPassword";
FLUSH PRIVILEGES;
quit

If the database server is a remote server, assign privileges to users with specific IP addresses, such as:

'metabase'@'192.168.0.20'

Or allow access by any IP-access to servers with public access is not recommended:

'metabase'@'%'

Step 3: Install the metabase on Debian 10 / Debian 9

Download the metabase And save it on the path from which you want to run the application.

export VER=0.34.1
wget http://downloads.metabase.com/v${VER}/metabase.jar
sudo mkdir -p /apps/java
sudo cp metabase.jar /apps/java

Run Metabase to use javaCommand to start the application.

$ java -jar metabase.jar
01-14 21:24:56 DEBUG plugins.classloader :: Using NEWLY CREATED classloader as shared context classloader: [email protected]
01-14 21:24:57 INFO metabase.util :: Loading Metabase...
01-14 21:24:57 INFO metabase.util :: Maximum memory available to JVM: 483.4 MB
01-14 21:25:01 INFO util.encryption :: Saved credentials encryption is DISABLED for this Metabase instance. 🔓 
 For more information, see https://metabase.com/docs/latest/operations-guide/encrypting-database-details-at-rest.html
.....

This will launch the Metabase application with all default settings.

Step 4: Configure Metabase Systemd service

The best way to run Metabase is to initialize the system with Systemd, which is available on Debian 10 / Debian 9. For a separate guide to running Java applications on systemd, see our blog.

How to run Java Jar applications with Systemd on Linux

For simplicity, I will create a specific systemd service file for the configuration database

First create a system group for the user.

sudo groupadd -r appmgr

Next, we create a system user appmgr Use default group

sudo useradd -r -s /bin/false -g appmgr appmgr

Grant this user ownership of the application directory:

sudo chown -R appmgr:appmgr /apps/java

Create a system service unit file:

sudo nano /etc/systemd/system/metabase.service

Add the following to the file.

[Unit]
Description=Metabase applicaion service
Documentation=https://www.metabase.com/docs/latest

[Service]
WorkingDirectory=/apps/java
ExecStart=/usr/bin/java -Xms128m -Xmx256m -jar metabase.jar
User=appmgr
Type=simple
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Set the maximum and minimum memory values ​​allowed by the Java application ( -Xms128m and -Xmx256m )In my case

The next thing to do is start the application service, but first, reload systemd so that it loads the new application you added.

sudo systemctl daemon-reload

After reloading, start the service and set it to start at startup:

sudo systemctl start metabase.service
sudo systemctl enable metabase.service

To check the status, use:

$ sudo systemctl status metabase
● metabase.service - Metabase applicaion service
   Loaded: loaded (/etc/systemd/system/metabase.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-01-14 21:49:02 UTC; 55s ago
     Docs: https://www.metabase.com/docs/latest
 Main PID: 3698 (java)
    Tasks: 65 (limit: 2377)
   Memory: 604.1M
   CGroup: /system.slice/metabase.service
           └─3698 /usr/bin/java -Xms128m -Xmx256m -jar metabase.jar

Jan 14 21:49:33 deb10 java[3698]: 01-14 21:49:33 INFO sync.analyze :: classify-tables Analyzed [**************************************············] 😋  
Jan 14 21:49:33 deb10 java[3698]: 01-14 21:49:33 INFO sync.analyze :: classify-tables Analyzed [**********************************************····] 😍  
Jan 14 21:49:33 deb10 java[3698]: 01-14 21:49:33 INFO sync.util :: FINISHED: step 'classify-tables' for h2 Database 1 'Sample Dataset' (15.8 ms)
Jan 14 21:49:33 deb10 java[3698]: 01-14 21:49:33 INFO sync.util :: FINISHED: Analyze data for h2 Database 1 'Sample Dataset' (5.6 s)
Jan 14 21:49:33 deb10 java[3698]: 01-14 21:49:33 INFO sync.util :: STARTING: Cache field values in h2 Database 1 'Sample Dataset'
Jan 14 21:49:33 deb10 java[3698]: 01-14 21:49:33 INFO sync.util :: STARTING: step 'update-field-values' for h2 Database 1 'Sample Dataset'
Jan 14 21:49:34 deb10 java[3698]: 01-14 21:49:34 INFO sync.util :: FINISHED: step 'update-field-values' for h2 Database 1 'Sample Dataset' (809.0 ms)
Jan 14 21:49:34 deb10 java[3698]: 01-14 21:49:34 INFO sync.util :: FINISHED: Cache field values in h2 Database 1 'Sample Dataset' (811.6 ms)
Jan 14 21:49:34 deb10 java[3698]: 01-14 21:49:34 INFO sync.util :: FINISHED: Sync h2 Database 1 'Sample Dataset' (7.5 s)
Jan 14 21:49:34 deb10 java[3698]: 01-14 21:49:34 INFO metabase.core :: Metabase Initialization COMPLETE

Step 4: Access the Metabase Web User Interface

After the service starts, the Metabase server will listen on the port 3000 by default.

$ ss -tunelp | grep 3000tcp LISTEN 0 50 *:3000 *:* users:(("java",pid=14386,fd=18)) uid:998 ino:85041 sk:a v6only:0 <->

Visit the webpage to complete the setup http://:3000

Click “let’s start“Button to begin setup. On the next page, create a user to manage the metabase

Install Metabase with Systemd on Debian 10 / Debian 9

Provide information about your MySQL database-username and password. If you don’t have one yet, Metabase also comes with a sample dataset, you can start using it.

Install Metabase with Systemd on Debian 10 / Debian 9

You need to provide the data to the database configured above. The configuration database will check the data there. Once you are set up, you will have access to the Metabase Management panel

Install Metabase with Systemd on Debian 10 / Debian 9

See metabase getting Started The page starts adding data sets and plays the data. Also, please visit Official configuration database documentation Detailed settings and management.

Also check:

How to install the latest phpMyAdmin on Debian

How to install pgAdmin 4 on Debian

How to install ArangoDB on Ubuntu 18.04 Bionic Beaver

Install Dgraph on CentOS 7 / Ubuntu 18.04

Sidebar