Metabase is a free, open-source, web-based database lookup tool. It can be integrated with any database and provides a graphical interface to run queries on the database. Metabase supports several databases such as MySQL/MariaDB, Postgres, Mongo, SQL Server, Druid, H2, SQLite, and Oracle business. It is a powerful analytics tool that allows you to learn and make decisions from your company’s data without any technical knowledge required.

In this tutorial, we will explain how to install Metabase on Oracle Linux 8.

Step 1 – Install Java JDK

Metabase is written in Java, so you will need to install Java JDK on your server. You can install it by running the following command:

dnf update -y
dnf install java-11-openjdk-devel -y

Once Java is installed, verify the installed version of Java with the following command:

java --version

You should get the following output:

openjdk 11.0.16 2022-07-19 LTS
OpenJDK Runtime Environment (Red_Hat-11.0.16.0.8-1.el8_6) (build 11.0.16+8-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-11.0.16.0.8-1.el8_6) (build 11.0.16+8-LTS, mixed mode, sharing)

Step 2 – Install and Configure MariaDB

Next, you will need to install the MariaDB and Rsyslog servers in your system. You can install them with the following command:

dnf install mariadb-server -y
dnf install rsyslog -y

Once installed, start the MariaDB and Rsyslog services and enable them to start on system reboot with the following command:

systemctl start mariadb rsyslog
systemctl enable mariadb rsyslog

Next, log in to MariaDB with the following command:

mysql

Once logged in, create a database and user for Metabase with the following command:

create database metabasedb;
create user metabaseuser@'localhost' identified by 'password';

Next, grant all the privileges to the Metabase with the following command:

grant all on metabasedb.* to metabaseuser@'localhost' with grant option;

Next, flush the privileges and exit from the MariaDB with the following command:

flush privileges;
exit;

Step 3 – Install Metabase on Oracle Linux 8

First, create a dedicated user and group for Metabase with the following command:

groupadd --system metabase
useradd --system -g metabase --no-create-home metabase

Next, create the necessary directories and files for Metabase:

mkdir -p /opt/metabase
touch /var/log/metabase.log
touch /etc/default/metabase

Next, change the ownership of the Metabase directories and files with the following command:

chown -R metabase:metabase /opt/metabase
chown metabase:metabase /var/log/metabase.log
chmod 640 /etc/default/metabase

Next, create a log file for Metabase with the following command:

nano /etc/rsyslog.d/metabase.conf

Add the following lines:

:msg,contains,"metabase" /var/log/metabase.log
& stop

Save and close the file, then restart the rsyslog service with the following command:

systemctl restart rsyslog

Next, change the directory to metabase and download the latest version of Metabase with the following command:

cd /opt/metabase
wget https://downloads.metabase.com/v0.44.2/metabase.jar

Next, change the ownership of the downloaded file to Metabase with the following command:

chown -R metabase:metabase /opt/metabase

Step 4 – Create a System Service File for Metabase

Next, it is recommended to create a systemd service file to manage the Metabase service. You can create it with the following command:

nano /etc/systemd/system/metabase.service

Add the following lines:

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

[Service]
WorkingDirectory=/opt/metabase/
ExecStart=/usr/bin/java -jar /opt/metabase/metabase.jar
EnvironmentFile=/etc/default/metabase
User=metabase
Type=simple
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=metabase
SuccessExitStatus=143
TimeoutStopSec=120
Restart=always

[Install]
WantedBy=multi-user.target

Save and close the file, then reload the systemd daemon with the following command:

systemctl daemon-reload

Next, start the Metabase service and enable it to start at system reboot with the following command:

systemctl start metabase
systemctl enable metabase

You can now check the status of the Metabase service with the following command:

systemctl status metabase

You should get the following output:

● metabase.service - Metabase server
   Loaded: loaded (/etc/systemd/system/metabase.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2022-09-01 09:07:11 EDT; 4s ago
 Main PID: 20045 (java)
    Tasks: 19 (limit: 49496)
   Memory: 272.1M
   CGroup: /system.slice/metabase.service
           └─20045 /usr/bin/java -jar /opt/metabase/metabase.jar

Sep 01 09:07:11 oraclelinux8 systemd[1]: Started Metabase server.
Sep 01 09:07:13 oraclelinux8 metabase[20045]: Warning: protocol #'java-time.core/Amount is overwriting function abs
Sep 01 09:07:13 oraclelinux8 metabase[20045]: WARNING: abs already refers to: #'clojure.core/abs in namespace: java-time.core, being replaced>
Sep 01 09:07:13 oraclelinux8 metabase[20045]: WARNING: abs already refers to: #'clojure.core/abs in namespace: java-time, being replaced by: >
Sep 01 09:07:13 oraclelinux8 metabase[20045]: WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Sep 01 09:07:14 oraclelinux8 metabase[20045]: 2022-09-01 09:07:14,982 INFO metabase.util :: Maximum memory available to JVM: 1.9 GB
Sep 01 09:07:15 oraclelinux8 metabase[20045]: 2022-09-01 09:07:15,615 WARN db.env :: WARNING: Using Metabase with an H2 application datab

At this point, Metabase is started and listening on port 3000. You can check it with the following command:

ss -antpl | grep 3000

You should see the following output:

LISTEN 0      50                 *:3000             *:*    users:(("java",pid=20045,fd=13)) 

Step 5 – Access Metabase Web Interface

Now, open your web browser and access Metabase using the URL http://your-server-ip:3000. You should see the following page:
Metabase language selection page

Click on “Let’s get started”. You should see the following page:
Metabase language selection page
Select your language and click on the Next button. You should see the following page:
Metabase admin user creation page
Provide your full name, email address, and password and click on the Next button. You should see the following page:
Metabase database creation page
Provide your database details and click on the Connect Database button. You should see the following page:
select data usage page
Enable your “Usage data preferences” and click on the Finish button. You should see the following page:
Define email address page
Provide your admin email address and click on the Take me to Metabase button. You should see the Metabase default dashboard on the following page:
Metabase dashboard page

Conclusion

In this post, we learned how to install and configure Metabase on Oracle Linux 8. You can now connect your Metabase to an external database to query your own data. You can visit the Metabase official documentation for more information. Try it on dedicated hosting from Atlantic.Net!