Install Grafana on Debian 12
Step 1 – Install Grafana
wget -q -O - https://packages.grafana.com/gpg.key | gpg --dearmor | tee /usr/share/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/grafana.gpg] https://packages.grafana.com/oss/deb stable main" | tee /etc/apt/sources.list.d/grafana.list
apt update && apt install -y grafana
systemctl enable --now grafana-server
Step 2 – Access and initial setup
Grafana listens on port 3000 by default:
http://your-server:3000
Default credentials: admin / admin (change immediately).
Step 3 – Add Prometheus data source
- Go to Configuration → Data Sources → Add data source
- Select Prometheus
- Set URL:
http://localhost:9090 - Click Save & Test
Step 4 – Import dashboards
Popular dashboards from grafana.com:
- Node Exporter Full: ID
1860 - Nginx: ID
9614 - MySQL Overview: ID
7362 - PostgreSQL Statistics: ID
9628
Go to Dashboards → Import, enter the ID, select Prometheus data source.
Step 5 – Configure SMTP alerts
Edit /etc/grafana/grafana.ini:
[smtp]
enabled = true
host = smtp.example.com:587
user = [email protected]
password = SmtpPass!
from_address = [email protected]
from_name = Grafana
systemctl restart grafana-server