Grafana on Raspberry Pi4

This is a guide for installation of Grafana on Raspberry Pi 4 running Ubuntu Server 21.10.
This guide is written for installation on Raspberry Pi however setup would be nearly identical on a VPS.

Grafana is an open source visulization and analytics software. Grafana is awesome for analyzing IoT sensor data over long periods of time. It works great to read data stored in InfluxDB.

Table of Contents

    1. Install Ubuntu Server 21.10.

    See this guide for a secure basic installation of Ubuntu 21.10.

    2. Install Grafana

    The vendor repositories from Grafana will be used.
    Installed Version: 7.5.1

    The installation assumes user has root access

    1. Switch to root environment
      sudo -i
    2. Update Repositories
      • curl -sL https://packages.grafana.com/gpg.key | sudo apt-key add -
      • echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
      • apt-get update
    3. Install
      apt-get install -y grafana
    4. Enable services
      systemctl enable grafana-server
      systemctl start grafana-server
    5. The successful start can be verified via
      systemctl status grafana-server.service

    3. Configure Grafana Port

    The default port for Grafana is 3000. You can optionally change the default port using the following:

    1. open grafana configuration file
      nano /etc/grafana/grafana.ini
    2. Search for line = ;http_port = 3000 and change to desired port(example 3002)
      http_port = 3002
    3. Open port on firewall(change to whichever port you configured).
      ufw allow 3000/tcp

    I have multiple Pis running Grafana at my home and each one needs to use a unique port. We are going to change the default port from 3000 -> 3002. We will open up the port on the firewall. We will also configure the dashboard to be readable without logging into and account. You will need to login to an account to modify the dashboard.

    4. Configure Grafana Dashboards to be viewable by public without login

    By default Grafana is configured so that you need to be logged into to edit or view dashboards. Often I want dashboards to be viewable by others without a login.

    1. Make Grafana dashboard public without login. Edit Grafana config file
      nano /etc/grafana/grafana.ini
    2. in the [auth.anonymous] section make the following changes.
    [auth.anonymous]
    # enable anonymous access
    enabled = true
    
    # specify organization name that should be used for unauthenticated users
    org_name = Main Org.
    
    # specify role for unauthenticated users
    org_role = Viewer
    1. Restart Grafana
      service grafana-server restart
    2. Open the following URL in your webbrowser: to reach the login screen.
      http://RASPBERRYPI_IPADDRESS:3000/login
      Default login is user=admin, password=admin
      It will ask you to change the default password. Change default login info:
      username: admin
      password: friends (use your own password)
    3. switch back to user account
      exit