Cara Install Metabase Data Visualization di Ubuntu 20.04

Metabase adalah data visualization tool berbasis web yang dapat digunakan untuk menganalisa dataset dan memvisualisasikannya dalam bentuk grafik.

Metabase menyediakan dua tipe deployment yaitu Cloud, Metabase sebagai sebuah layanan (Metabase as a Service), dan On-Premise, dikelola di server sendiri. Model On-Premise ini yang dapat diinstall di server sendiri dengan menggunakan Metabase versi Open Source.

*Tutorial Environment*

Server dan software yang digunakan pada tutorial ini:

· OS: Ubuntu Server 20.04 · Java: OpenJDK 11 · Database: MariaDB · Web Server: Nginx · SSL: Let’s Encrypt · Subdomain: metabase.musaamin.my.id · Metabase: v0.41.5

*Install Java*

Metabase merupakan aplikasi berbasis bahasa pemrograman Java. Oleh karena itu harus install Java terlebih dahulu.

[INPUT]

1 apt install openjdk-11-jdk openjdk-11-jre

Memverifikasi versi Java yang terpasang.

[INPUT]

1 java -version

Hasilnya.

[INPUT]

1 2 3 openjdk version “11.0.13” 2021-10-19 OpenJDK Runtime Environment (build 11.0.13+8-Ubuntu-0ubuntu1.20.04) OpenJDK 64-Bit Server VM (build 11.0.13+8-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)

*Install MariaDB*

Selanjutnya install MariaDB database.

[INPUT]

1 apt install mariadb-server

Login ke MariaDB shell.

[INPUT]

1 mysql

Membuat database dan user.

[INPUT]

1 2 3 4 CREATE DATABASE metabase; GRANT ALL PRIVILEGES ON metabase.* TO ‘metabase’@’localhost’ IDENTIFIED BY ‘rahasia’; FLUSH PRIVILEGES; exit

*Download Metabase*

Membuat folder metabase di dalam /opt.

[INPUT]

1 mkdir /opt/metabase

Download metabase.jar

[INPUT]

1 wget https://downloads.metabase.com/v0.41.5/metabase.jar -O /opt/metabase/metabase.jar

Membuat user dan group untuk metabase.

[INPUT]

1 2 addgroup –quiet –system metabase adduser –quiet –system –ingroup metabase –no-create-home –disabled-password metabase

Mengubah ownership dan permission folder.

[INPUT]

1 2 chown -R metabase:metabase /opt/metabase chmod -R 755 /opt/metabase

*Membuat Systemd Service*

Membuat systemd service file untuk mengatur Metabase service.

[INPUT]

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

Masukkan konfigurasi berikut ini:

[INPUT]

1 2 3 4 5 6 7 8 9 10 11 12 13 [Unit] Description=Metabase server   [Service] WorkingDirectory=/opt/metabase/ ExecStart=/usr/bin/java -jar /opt/metabase/metabase.jar User=metabase Type=simple Restart=on-failure RestartSec=10   [Install] WantedBy=multi-user.target

Reload systemd daemon.

[INPUT]

1 systemctl daemon-reload

Menjalankan dan mengaktifkan service saat system boot.

[INPUT]

1 2 systemctl start metabase systemctl enable metabase

Mengecek status service Metabase.

[INPUT]

1 systemctl status metabase

Hasilnya.

[INPUT]

1 2 3 4 5 6 7 8 “— metabase.service – Metabase server      Loaded: loaded (/etc/systemd/system/metabase.service; enabled; vendor preset: enabled)      Active: active (running) since Tue 2022-01-11 01:15:51 UTC; 1min 31s ago    Main PID: 6354 (java)       Tasks: 64 (limit: 4612)      Memory: 678.3M      CGroup: /system.slice/metabase.service              “””””€6354 /usr/bin/java -jar /opt/metabase/metabase.jar

*Install Nginx*

Install Nginx sebagai reverse proxy untuk Metabase.

[INPUT]

1 apt install nginx

Membuat file konfigurasi Nginx server block.

[INPUT]

1 nano /etc/nginx/conf.d/metabase.musaamin.my.id.conf

Masukkan konfigurasi berikut:

[INPUT]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 upstream metabase {   server 127.0.0.1:3000; }   server {     listen 80;     server_name metabase.musaamin.my.id;       location / {         proxy_pass http://metabase/;         proxy_http_version 1.1;         proxy_set_header Upgrade $http_upgrade;         proxy_set_header Connection “upgrade”;         proxy_set_header Host $http_host;           proxy_set_header X-Real-IP $remote_addr;         proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;         proxy_set_header X-Forward-Proto http;         proxy_set_header X-Nginx-Proxy true;           proxy_redirect off;     }       access_log /var/log/nginx/metabase.musaamin.my.id-access.log;     error_log /var/log/nginx/metabase.musaamin.my.id-error.log;     }

Verifikasi konfigurasi Nginx.

[INPUT]

1 nginx -t

Hasilnya.

[INPUT]

1 2 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart dan cek status service Nginx.

[INPUT]

1 2 systemctl restart nginx systemctl status nginx

Hasilnya.

[INPUT]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 “— nginx.service – A high performance web server and a reverse proxy server      Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)      Active: active (running) since Tue 2022-01-11 01:27:15 UTC; 3s ago        Docs: man:nginx(8)     Process: 7211 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=/SUCCESS)     Process: 7226 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=/SUCCESS)    Main PID: 7229 (nginx)       Tasks: 3 (limit: 4612)      Memory: 3.4M      CGroup: /system.slice/nginx.service              “”œ””€7229 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;              “”œ””€7230 nginx: worker process              “””””€7231 nginx: worker process   Jan 11 01:27:15 ubuntu systemd[1]: Starting A high performance web server and a reverse proxy server… Jan 11 01:27:15 ubuntu systemd[1]: Started A high performance web server and a reverse proxy server.

*Install Let’s Encrypt*

Install Let’s Encrypt untuk SSL.

[INPUT]

1 apt install python3-certbot-nginx

Request SSL untuk metabase.

[INPUT]

1 certbot –non-interactive -m email@example.com –agree-tos –no-eff-email –nginx -d metabase.musaamin.my.id –redirect

*Metabase Web Interface*

Akses URL metabase. Klik *Let’s get started*.

Metabase installation

Pilih bahasa *(English)*, *Next*.

Preferred language

Masukkan nama, alamat email, password. *Next*

User account

Pilih *Database type* = *MySQL*, lalu masukkan nama database, username, dan password yang telah dibuat sebelumnya. *Next*.

Add database

Nonaktifkan *Allow Metabase to anonymously collect usage events*. *Next*.

Usage data preferences

*You’re all set up!*, Metabase telah selesai terinstall. Klik *Take me to Metabase*.

Installation completed

Metabase siap untuk digunakan.

Metabase dashboard

Selamat mencoba 🙂

Leave a Reply

Your email address will not be published.