10 min read

How to Self-Host Grafana and Access Your Dashboards from Anywhere

Self-host Grafana on Linux or Docker, connect Prometheus, and access your dashboards from anywhere securely with a Localtonet tunnel. No open ports required.

📊 Grafana · Monitoring · Self-Host · Remote Access · 2026

How to Self-Host Grafana and Access Your Dashboards from Anywhere

Grafana is the most widely used open-source platform for visualizing metrics, logs, and traces. This guide covers two installation paths native packages on Linux and Docker Compose connecting Prometheus as a data source, and making your dashboards securely reachable from any device using a Localtonet tunnel.

📈 Metrics and dashboards 🐳 Docker Compose support 🔒 No open firewall ports 🌍 Remote access from anywhere

What Is Grafana?

Grafana is an open-source analytics and visualization platform. You connect it to a data source Prometheus, InfluxDB, Loki, MySQL, PostgreSQL, or dozens of others and it turns raw metrics into interactive dashboards you can share with your team or keep for yourself.

It runs entirely on your own hardware. Your metrics, your infrastructure details, and your alerting rules never leave your environment. This makes self-hosted Grafana a popular choice for teams that want full observability without paying for cloud monitoring services.

📊 Rich dashboards Dozens of panel types: graphs, gauges, tables, heatmaps, stat panels, and more. Thousands of community dashboards ready to import.
🔌 Many data sources Prometheus, InfluxDB, Loki, Elasticsearch, MySQL, PostgreSQL, Jaeger, Tempo, and many more out of the box.
🔔 Alerting built in Define alert rules directly in Grafana and route notifications to Slack, PagerDuty, email, or webhooks.
👥 Multi-user support Create organizations, teams, and users with role-based access. Share dashboards selectively without exposing everything.
🆓 Free and open source Grafana OSS is completely free. Grafana Enterprise adds plugins and licensing for larger teams but is not required.
🐳 Docker-native Official images on Docker Hub. Works perfectly in Compose alongside Prometheus and Node Exporter for a full monitoring stack.

Option A: Install Grafana on Linux (Ubuntu / Debian)

Installing from the official Grafana APT repository is the recommended approach for Linux servers. It registers Grafana as a systemd service that starts automatically on boot.

1

Add the Grafana APT repository

sudo apt-get install -y apt-transport-https software-properties-common wget

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
2

Install Grafana and start the service

sudo apt-get update
sudo apt-get install -y grafana

sudo systemctl daemon-reload
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
3

Verify it is running

sudo systemctl status grafana-server

Grafana is now running on port 3000. Open http://localhost:3000 in your browser. Log in with the default credentials username admin and password admin. Grafana will ask you to change the password on first login.

Red Hat, Fedora, or CentOS

Grafana also provides an official RPM repository. The setup is similar: add the YUM repository from https://rpm.grafana.com, then run sudo dnf install grafana. Full instructions are on the Grafana installation docs.

Option B: Install Grafana with Docker Compose

Docker Compose is the fastest way to spin up a full monitoring stack. The example below runs Grafana and Prometheus together, with persistent volumes so your dashboards and data survive container restarts.

1

Create the project directory and files

mkdir grafana-stack && cd grafana-stack
touch docker-compose.yml prometheus.yml
2

Create the Docker Compose file

services:
  grafana:
    image: grafana/grafana-enterprise
    container_name: grafana
    restart: unless-stopped
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=changeme
    volumes:
      - grafana_data:/var/lib/grafana

  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
      - prometheus_data:/prometheus

volumes:
  grafana_data:
  prometheus_data:
Change the default password

Replace changeme with a strong password before running the stack. The default admin/admin credentials are widely known and should never be left in place on a machine accessible from the internet.

3

Create the Prometheus config

global:
  scrape_interval: 15s

scrape_configs:
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]
4

Start the stack

docker compose up -d
docker compose ps

Grafana is now available at http://localhost:3000. Log in with username admin and the password you set in the Compose file.

Add Prometheus as a Data Source

Once Grafana is running, connect it to Prometheus so you can start building dashboards.

1

Open Connections in the left sidebar

Go to Connections → Data sources → Add new data source and select Prometheus.

2

Set the Prometheus URL

If Grafana and Prometheus are running in the same Docker Compose stack, use http://prometheus:9090. Docker's internal DNS resolves the container name automatically. For a native Linux install where Prometheus runs as a separate service, use http://localhost:9090.

3

Click Save and test

Grafana will verify the connection. If it shows a green success message, the data source is working.

4

Import a community dashboard

Go to Dashboards → Import and enter a dashboard ID from grafana.com/grafana/dashboards. Dashboard 1860 is the popular Node Exporter Full dashboard for Linux host metrics. Enter the ID, click Load, select your Prometheus data source, and click Import.

Access Grafana Remotely with Localtonet

Grafana listens on port 3000 by default, but only on your local machine or network. To reach your dashboards from your phone, a remote office, or another country, you need a way to route traffic to that port from the public internet without opening your firewall or having a public IP.

Localtonet creates an encrypted HTTP tunnel that gives your Grafana instance a public HTTPS URL. The Grafana server itself requires no changes.

1

Install and authenticate Localtonet

Download Localtonet for your platform from localtonet.com/download and authenticate with your AuthToken from Dashboard → My Tokens.

2

Create an HTTP tunnel for port 3000

Log in to the Localtonet dashboard, go to Tunnels → New Tunnel, select HTTP, set local IP to 127.0.0.1 and port to 3000. Click Create. Localtonet generates a public HTTPS URL automatically.

3

Start the Localtonet client

localtonet --authtoken <YOUR_TOKEN>

Your Grafana dashboards are now reachable at the HTTPS URL shown in the dashboard from your phone, a remote team member's browser, or anywhere with an internet connection.

Keep Grafana and Localtonet running after a reboot

If you installed Grafana natively on Linux, it is already registered as a systemd service and starts on boot. For Localtonet, use service mode so the tunnel also comes back automatically after a restart.

sudo localtonet --install-service --authtoken <YOUR_TOKEN>
sudo localtonet --start-service --authtoken <YOUR_TOKEN>

For the Docker Compose setup, both Grafana and Prometheus already have restart: unless-stopped, so they start automatically with Docker on every boot. Run Localtonet in service mode on the host machine as shown above.

Security Recommendations

🔑 Change the default admin password immediately

The default admin/admin credentials are the first thing any automated scanner will try. Change the password on first login, or set GF_SECURITY_ADMIN_PASSWORD in your Docker Compose file before the first run. You cannot undo a compromised Grafana instance easily.

🌍 Use Localtonet instead of opening port 3000 publicly

Do not bind port 3000 to a public network interface and open it in your firewall. Use a Localtonet HTTP tunnel instead. Grafana stays bound to localhost only. The tunnel gives you a public URL without exposing the port directly.

🔐 Add Localtonet SSO for an extra authentication layer

In the Localtonet dashboard, enable Single Sign-On on your tunnel. Anyone reaching your Grafana URL must authenticate via Google, GitHub, Microsoft, or GitLab first. This adds a second login layer in front of Grafana's own authentication.

👤 Use role-based access inside Grafana

Create separate user accounts for each team member rather than sharing the admin credentials. Assign Viewer role to people who only need to see dashboards and reserve Editor and Admin roles for those who build and manage them.

🚫 Do not expose Prometheus publicly

Prometheus has no built-in authentication. In the Docker Compose setup above, Prometheus is not mapped to a host port on purpose. Grafana accesses it over the internal Docker network. If you need to query Prometheus from outside, create a separate Localtonet tunnel only for that purpose and stop the tunnel when you are done.

Frequently Asked Questions

Can I run Grafana on a Raspberry Pi?

Yes. Grafana provides ARM and ARM64 packages. The APT repository installation works on Raspberry Pi OS without any extra steps. For a low-spec Pi, use Grafana OSS rather than the Enterprise image and keep the number of active dashboards small to stay within memory limits.

Will my dashboards survive a Docker container restart?

Yes, as long as you use a named volume for /var/lib/grafana as shown in the Compose file above. Docker stores the volume data on the host. The container can be stopped, removed, and recreated without losing any dashboards, data sources, or user accounts.

Can I connect Grafana to data sources other than Prometheus?

Yes. Grafana supports many data sources out of the box: InfluxDB, Loki (for logs), Elasticsearch, MySQL, PostgreSQL, Jaeger, Tempo, and more. Each data source is configured separately under Connections → Data sources. You can mix multiple sources in a single dashboard.

The Localtonet tunnel URL changes every time. How do I get a fixed URL?

For HTTP tunnels, you can attach a custom domain in the Localtonet dashboard. Go to Tunnels → your tunnel → Custom Domain, enter your domain, and add the required DNS record. Your Grafana instance will then always be at the same address. Check out our custom domain guide for step-by-step instructions.

How do I monitor Docker containers with Grafana?

Add cAdvisor to your Compose stack to collect per-container metrics, and add Node Exporter for host-level metrics. Both expose a Prometheus-compatible endpoint. Add them as scrape targets in prometheus.yml, then import dashboard ID 193 (Docker and system monitoring) from the Grafana dashboard library.

Can I use Grafana alerting with a self-hosted setup?

Yes. Grafana's built-in alerting engine works in self-hosted installations without any cloud dependency. Configure alert rules under Alerting → Alert rules, set up a contact point (Slack, email, PagerDuty, webhook), and create a notification policy. Alerts fire based on queries against your connected data sources.

Your Monitoring Dashboards, Accessible from Anywhere

Install Grafana, connect your data sources, and open a Localtonet tunnel. Your team gets a secure HTTPS URL for your dashboards in minutes, with no open firewall ports and no cloud bill.

Create Free Localtonet Account →

Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.

support