Metabase Setup on VPS and WordPress Integration (DB, SQL, Reports)
Budget: $10 – $30 USD
I need to connect MetaBase to Wordpress Website but before that I need to set up my VPS.
To install the following : Database sync automatically > Creating my reports > Metabase sync > MySQL to manage the data.
I hope that I forget nothing, let me know otherwise.
Here is what chatgrpt is telling me to do, if it can help :
Step-by-step Guide to Set Up Metabase on a VPS and Embed it in WordPress
Step 1: Choose and Purchase a VPS
Select a reliable VPS provider with shared vCPUs and at least 2GB RAM, e.g., Hetzner, Contabo, or Scaleway.
Make sure the VPS has a Linux OS (Ubuntu 22.04 LTS recommended).
Purchase the VPS and note down:
IP address
SSH login credentials (username, password/private key)
Step 2: Prepare the VPS Environment
Connect to the VPS via SSH.
Update the server packages:
bash
Copier
Modifier
sudo apt update && sudo apt upgrade -y
Install Docker and Docker Compose (Metabase runs easily on Docker):
bash
Copier
Modifier
sudo apt install docker.io docker-compose -y
sudo systemctl enable docker --now
Step 3: Set Up MySQL Database
Install MySQL or MariaDB on the VPS:
bash
Copier
Modifier
sudo apt install mysql-server -y
Secure the MySQL installation:
bash
Copier
Modifier
sudo mysql_secure_installation
Create a database and a user for Metabase:
sql
Copier
Modifier
CREATE DATABASE metabase_db;
CREATE USER 'metabase_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON metabase_db.* TO 'metabase_user'@'localhost';
FLUSH PRIVILEGES;
If your WordPress MySQL is on EasyWP (Namecheap) and not accessible externally, you must export your WordPress database regularly and import it into this MySQL to keep data in sync.
Step 4: Deploy Metabase with Docker
Create a docker-compose.yml file with this content:
yaml
Copier
Modifier
version: '3'
services:
metabase:
image: metabase/metabase
ports:
- "3000:3000"
environment:
- MB_DB_TYPE=mysql
- MB_DB_DBNAME=metabase_db
- MB_DB_PORT=3306
- MB_DB_USER=metabase_user
- MB_DB_PASS=secure_password
- MB_DB_HOST=localhost
Run Metabase:
bash
Copier
Modifier
docker-compose up -d
Verify Metabase is running by visiting http://your-vps-ip:3000
Step 5: Configure Metabase
On first launch, create the admin user.
Connect Metabase to the MySQL database where you import WordPress data.
Build your dashboards and reports.
Step 6: Enable Public Sharing and Get iframe URL
In Metabase, for each dashboard or question, enable public sharing.
Copy the iframe embed URL.
Step 7: Embed Metabase Dashboards into WordPress
On your WordPress site, create a page or post where you want the dashboard.
Use the WordPress Custom HTML block (or a plugin for embedding iframes).
Paste the iframe code from Metabase.
Step 8: Automate WordPress Database Sync (Optional but Recommended)
Since EasyWP MySQL is not remotely accessible:
Set up a script (cron job) to export your WordPress database regularly (e.g., daily).
Import the exported dump into your VPS MySQL, so Metabase has updated data.
Optional Step 9: Secure Your VPS and Metabase
Set up a firewall (e.g., ufw) to allow only needed ports (80, 443, 3000).
(Optional) Set up HTTPS with a reverse proxy like Nginx + Let’s Encrypt for secure access.
To install the following : Database sync automatically > Creating my reports > Metabase sync > MySQL to manage the data.
I hope that I forget nothing, let me know otherwise.
Here is what chatgrpt is telling me to do, if it can help :
Step-by-step Guide to Set Up Metabase on a VPS and Embed it in WordPress
Step 1: Choose and Purchase a VPS
Select a reliable VPS provider with shared vCPUs and at least 2GB RAM, e.g., Hetzner, Contabo, or Scaleway.
Make sure the VPS has a Linux OS (Ubuntu 22.04 LTS recommended).
Purchase the VPS and note down:
IP address
SSH login credentials (username, password/private key)
Step 2: Prepare the VPS Environment
Connect to the VPS via SSH.
Update the server packages:
bash
Copier
Modifier
sudo apt update && sudo apt upgrade -y
Install Docker and Docker Compose (Metabase runs easily on Docker):
bash
Copier
Modifier
sudo apt install docker.io docker-compose -y
sudo systemctl enable docker --now
Step 3: Set Up MySQL Database
Install MySQL or MariaDB on the VPS:
bash
Copier
Modifier
sudo apt install mysql-server -y
Secure the MySQL installation:
bash
Copier
Modifier
sudo mysql_secure_installation
Create a database and a user for Metabase:
sql
Copier
Modifier
CREATE DATABASE metabase_db;
CREATE USER 'metabase_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON metabase_db.* TO 'metabase_user'@'localhost';
FLUSH PRIVILEGES;
If your WordPress MySQL is on EasyWP (Namecheap) and not accessible externally, you must export your WordPress database regularly and import it into this MySQL to keep data in sync.
Step 4: Deploy Metabase with Docker
Create a docker-compose.yml file with this content:
yaml
Copier
Modifier
version: '3'
services:
metabase:
image: metabase/metabase
ports:
- "3000:3000"
environment:
- MB_DB_TYPE=mysql
- MB_DB_DBNAME=metabase_db
- MB_DB_PORT=3306
- MB_DB_USER=metabase_user
- MB_DB_PASS=secure_password
- MB_DB_HOST=localhost
Run Metabase:
bash
Copier
Modifier
docker-compose up -d
Verify Metabase is running by visiting http://your-vps-ip:3000
Step 5: Configure Metabase
On first launch, create the admin user.
Connect Metabase to the MySQL database where you import WordPress data.
Build your dashboards and reports.
Step 6: Enable Public Sharing and Get iframe URL
In Metabase, for each dashboard or question, enable public sharing.
Copy the iframe embed URL.
Step 7: Embed Metabase Dashboards into WordPress
On your WordPress site, create a page or post where you want the dashboard.
Use the WordPress Custom HTML block (or a plugin for embedding iframes).
Paste the iframe code from Metabase.
Step 8: Automate WordPress Database Sync (Optional but Recommended)
Since EasyWP MySQL is not remotely accessible:
Set up a script (cron job) to export your WordPress database regularly (e.g., daily).
Import the exported dump into your VPS MySQL, so Metabase has updated data.
Optional Step 9: Secure Your VPS and Metabase
Set up a firewall (e.g., ufw) to allow only needed ports (80, 443, 3000).
(Optional) Set up HTTPS with a reverse proxy like Nginx + Let’s Encrypt for secure access.
Related categories:
PHP
System Admin
Linux
SQL
WordPress
MySQL
VPS
Ubuntu
Docker
Database Management