Come installare Metabase Business Analytics su Ubuntu 20.04 LTS
Questo tutorial esiste per queste versioni del sistema operativo
- Ubuntu 20.04 (Focal Fossa)
- Ubuntu 18.04 (Bionic Beaver)
Su questa pagina
- Prerequisiti
- Installa Java
- Installa e configura MariaDB
- Scarica Metabase
- Crea un file di servizio Systemd per Metabase
- Configura Nginx come proxy inverso per Metabase
- Proteggi la metabase con Lets Encrypt
- Accedi all'interfaccia web della metabase
- Conclusione
Metabase è uno strumento di business intelligence gratuito e open source che può essere utilizzato per cercare set di dati e visualizzare informazioni. È uno strumento di analisi semplice e potente che ti aiuta a imparare dai dati della tua azienda senza alcuna conoscenza tecnica. Ti consente di generare grafici e dashboard, porre query senza utilizzare SQL e visualizzare informazioni dettagliate sulle righe nel tuo database.
Metabase è la scelta giusta per te se stai cercando una piattaforma di ricerca di database ad alte prestazioni per la tua azienda.
In questo tutorial, spiegheremo come installare Metabase su Ubuntu 20.04 con Nginx e Lets Encrypt SSL.
Prerequisiti
- Un server che esegue Ubuntu 20.04.
- Un nome di dominio valido indicato con l'IP del tuo server.
- Il server è configurato con una password di root.
Installa Java
Metabase è un'applicazione basata su Java. Quindi Java deve essere installato nel tuo server. Puoi installarlo con il seguente comando:
apt-get install openjdk-11-jdk openjdk-11-jre -y
Al termine dell'installazione, è possibile verificare la versione di Java con il seguente comando:
java -version
Dovresti vedere il seguente output:
openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04) OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)
Una volta terminato, puoi procedere al passaggio successivo.
Installa e configura MariaDB
Successivamente, dovrai installare il server del database MariaDB nel tuo sistema. Puoi installarlo eseguendo il seguente comando:
apt-get install mariadb-server -y
Una volta installato il server MariaDB, accedi alla shell MariaDB con il seguente comando:
mysql
Una volta effettuato l'accesso, crea un database e un utente per Metabase con il seguente comando:
MariaDB [(none)]> CREATE DATABASE metabase;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON metabase.* TO 'metabase'@'localhost' IDENTIFIED BY "password";
Successivamente, svuota i privilegi ed esci dalla shell MariaDB con il seguente comando:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Una volta terminato, puoi procedere al passaggio successivo.
Scarica Metabase
Innanzitutto, crea una directory per Metabase all'interno della directory /opt con il seguente comando:
mkdir /opt/metabase
Quindi, cambia la directory in /opt/metabase e scarica l'ultima versione di Metabase con il seguente comando:
cd /opt/metabase
wget https://downloads.metabase.com/v0.36.2/metabase.jar
Successivamente, sarà necessario creare un utente e un gruppo separati per eseguire Metabase. Puoi crearli con il seguente comando:
addgroup --quiet --system metabase
adduser --quiet --system --ingroup metabase --no-create-home --disabled-password metabase
Quindi, modifica la proprietà di /opt/metabase in metabase e dai l'autorizzazione appropriata con il seguente comando:
chown -R metabase:metabase /opt/metabase
chmod -R 755 /opt/metabase
Una volta terminato, puoi procedere al passaggio successivo.
Creare un file di servizio Systemd per Metabase
Successivamente, dovrai creare un file di servizio systemd per gestire il servizio Metabase. Puoi crearlo con il seguente comando:
nano /etc/systemd/system/metabase.service
Aggiungi le seguenti righe:
[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
Salva e chiudi il file, quindi ricarica il demone systemd con il seguente comando:
systemctl daemon-reload
Successivamente, avvia il servizio Metabase e abilitalo per l'avvio al riavvio del sistema con il seguente comando:
systemctl start metabase
systemctl enable metabase
Ora puoi verificare lo stato di Metabase con il seguente comando:
systemctl status metabase
Dovresti vedere il seguente output:
? metabase.service - Metabase server Loaded: loaded (/etc/systemd/system/metabase.service; disabled; vendor preset: enabled) Active: active (running) since Sat 2020-08-01 10:14:02 UTC; 12s ago Main PID: 9650 (java) Tasks: 18 (limit: 2353) Memory: 150.2M CGroup: /system.slice/metabase.service ??9650 /usr/bin/java -jar /opt/metabase/metabase.jar Aug 01 10:14:02 ubunt4 systemd[1]: Started Metabase server. Aug 01 10:14:05 ubunt4 java[9650]: 08-01 10:14:05 INFO metabase.util :: Loading Metabase... Aug 01 10:14:06 ubunt4 java[9650]: 08-01 10:14:06 INFO metabase.util :: Maximum memory available to JVM: 498.0 MB
A questo punto, Metabase è avviato e in ascolto sulla porta 3000. Puoi verificarlo con il seguente comando:
netstat -tunelp | grep 3000
Dovresti vedere il seguente output:
tcp6 0 0 :::3000 :::* LISTEN 109 35366 9650/java
Configura Nginx come proxy inverso per Metabase
Successivamente, dovrai configurare Nginx come proxy inverso per Metabase. Innanzitutto, installa il server Web Nginx con il seguente comando:
apt-get install nginx -y
Dopo aver installato Nginx, crea un nuovo file di configurazione dell'host virtuale Nginx con il seguente comando:
nano /etc/nginx/sites-available/metabase.conf
Aggiungi le seguenti righe:
upstream metabase { server 127.0.0.1:3000; } server { listen 80; server_name metabase.linuxbuz.com; access_log /var/log/nginx/metabase.linuxbuz.com-access.log; error_log /var/log/nginx/metabase.linuxbuz.com-error.log; 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; } }
Salva e chiudi il file quando hai finito. Quindi, attiva l'host virtuale Nginx con il seguente comando:
ln -s /etc/nginx/sites-available/metabase.conf /etc/nginx/sites-enabled/
Successivamente, verifica Nginx per qualsiasi errore di configurazione con il seguente comando:
nginx -t
Dovresti vedere il seguente output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Infine, riavvia il servizio Nginx per applicare le modifiche:
systemctl restart nginx
A questo punto, Nginx è configurato per servire Metabase sulla porta 80. Ora puoi procedere al passaggio successivo.
Proteggi la metabase con Lets Encrypt
Innanzitutto, dovrai installare il client Certbot Lets Encrypt per installare e gestire SSL per il tuo dominio. Puoi installare il client Certbot con il seguente comando:
apt-get install python3-certbot-nginx -y
Una volta installato, proteggi il sito Web Metabase con Lets Encrypt SSL con il seguente comando:
certbot --nginx -d metabase.linuxbuz.com
Ti verrà chiesto di fornire la tua email e accettare i termini di servizio come mostrato di seguito:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for metabase.linuxbuz.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/metabase.conf
Successivamente, scegli se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Digita 2 e premi Invio per installare Lets Encrypt SSL per il tuo dominio.
Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/metabase.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://metabase.linuxbuz.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=metabase.linuxbuz.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/metabase.linuxbuz.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/metabase.linuxbuz.com/privkey.pem Your cert will expire on 2020-10-30. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le - We were unable to subscribe you the EFF mailing list because your e-mail address appears to be invalid. You can try again later by visiting https://act.eff.org.
Ora, il tuo sito Web Metabase è protetto con Lets Encrypt SSL.
Accesso all'interfaccia Web della metabase
Ora, apri il tuo browser web e digita l'URL https://metabase.linuxbuz.com. Verrai reindirizzato alla schermata di benvenuto di Metabase come mostrato di seguito:
Ora, fai clic sul pulsante Iniziamo. Dovresti vedere la seguente schermata:
Selezionare la lingua desiderata e fare clic sul pulsante Avanti. Dovresti vedere la seguente schermata:
Fornisci il tuo nome, indirizzo email, password e fai clic sul pulsante Avanti. Dovresti vedere la schermata di configurazione del database Metabase:
Fornisci le informazioni del tuo database e fai clic sul pulsante Avanti. Dovresti vedere la schermata delle preferenze dei dati di utilizzo di Metabase:
Abilita l'opzione desiderata e fai clic sul pulsante Avanti. Dovresti vedere la seguente schermata:
Fornisci il tuo indirizzo e-mail e fai clic su Portami a Metabase. Dovresti vedere il dashboard di Metabase nella seguente schermata:
Conclusione
Congratulazioni! hai installato con successo Metabase con Nginx e consente di crittografare SSL sul server Ubuntu 20.04. Ora puoi esplorare la metabase per nuove funzionalità. Non esitate a chiedermi se avete domande.