Installing Grafana on Raspberry OS.

Installing Grafana on Raspberry OS.

In a previous post we’ve installed Prometheus on Raspberry, and this time we are installing Grafana on a Raspberry Pi as part of our homelab monitoring server.

The Raspberry Pi we’ve chosen is this one.Model 3B -1GB.

So, let’s start with downloading the software first from this link.

And from the options, we select linux and armv7

But, how do we know that armv7 is the correct version for our Pi?

For that, we can use the following command.

raspi3b1gb@raspberrypi: /home/raspi3b1gb>
$ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Now that we know, which software version we can install, let's download it.

raspi3b1gb@raspmon: /home/raspi3b1gb>
$ wget https://dl.grafana.com/oss/release/grafana-7.3.7.linux-armv7.tar.gz

Then we can extract the installation files from the Gzip and rename the folder.

raspi3b1gb@raspmon: /home/raspi3b1gb>
$ tar -zxf grafana-7.3.7.linux-armv7.tar.gz

raspi3b1gb@raspmon: /home/raspi3b1gb>
$ mv grafana-7.3.7 grafana

And we can create a service so Grafana can run on the background and start automatically after a reboot.

raspi3b1gb@raspmon: /home/raspi3b1gb>
$ sudo vi /etc/systemd/system/grafana.service

And copy and paste the following. (replace User= with your user id).

[Unit]
Description=Grafana Server
After=network.target

[Service]
Type=simple
User=raspi3b1gb
ExecStart=/home/raspi3b1gb/grafana/bin/grafana-server
WorkingDirectory=/home/raspi3b1gb/grafana/
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

raspi3b1gb@raspmon: /home/raspi3b1gb>
$ sudo systemctl daemon-reload

raspi3b1gb@raspmon: /home/raspi3b1gb>
$ sudo systemctl start grafana

raspi3b1gb@raspmon: /home/raspi3b1gb>
$ sudo systemctl status grafana
● grafana.service - Grafana Server
   Loaded: loaded (/etc/systemd/system/grafana.service; disabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-01-14 12:42:54 GMT; 4s ago
 Main PID: 10515 (grafana-server)
    Tasks: 9 (limit: 2063)
   CGroup: /system.slice/grafana.service
           └─10515 /home/raspi3b1gb/grafana/bin/grafana-server


raspi3b1gb@raspmon: /home/raspi3b1gb>
$ sudo systemctl enable grafana
Created symlink /etc/systemd/system/multi-user.target.wants/grafana.service → /etc/systemd/system/grafana.service.

and don’t forget to add port 3000 to your firewall list :-D.

$ sudo ufw allow 3000
Rule added
Rule added (v6)