Skip to main content

Install Grafana

sudo mkdir -p /etc/apt/keyrings/
wget -q -O- https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

sudo apt update
sudo apt install -y grafana

Configure the port

Edit /etc/grafana/grafana.ini to run on port 4000 instead of the default 3000:
sudo sed -i "s/^;http_port = 3000/http_port = 4000/" /etc/grafana/grafana.ini
The line starts commented out with ;http_port = 3000. Removing the ; and changing the value is what actually takes effect.

Enable and start

sudo systemctl enable grafana-server
sudo systemctl restart grafana-server
sudo systemctl status grafana-server --no-pager
Confirm it’s listening on the right port:
  sudo ss -tlnp | grep 4000
Default login: admin / admin (you’ll be prompted to change it on first login).

Add Loki as a data source

In Grafana UI: Connections → Data sources → Add data source → Loki
  URL: http://localhost:4100

Reverse proxy (optional)

If exposing Grafana on a subdomain instead of an IP:port, reuse the Nginx setup pattern with proxy_pass http://localhost:4000; and a server_name grafana.jethings.com;.

Useful checks

sudo systemctl status grafana-server --no-pager
sudo journalctl -u grafana-server -f