docs/sources/tutorials/install-grafana-on-raspberry-pi/index.md
The Raspberry Pi is a tiny, affordable, yet capable computer that can run a range of different applications. Even Grafana!
Many people are running Grafana on Raspberry Pi as a way to monitor their home, for things like indoor temperature, humidity, or energy usage.
In this tutorial, you'll:
{{% class "prerequisite-section" %}}
Before we can install Grafana, you first need to set up your Raspberry Pi.
For this tutorial, you'll configure your Raspberry Pi to be headless. This means you don't need to connect a monitor, keyboard, or mouse to your Raspberry Pi. All configuration is done from your regular computer.
Before we get started, you need to download and install the Raspberry Pi Imager.
We'll use the Raspberry Pi Imager to flash the operating system image to the SD card. You download the imager directly from the official Raspberry Pi website and it's available for Ubuntu Linux, macOS, and Windows.
Follow the directions on the website to download and install the imager.
Now it's time to install Raspberry Pi OS.
While you could fire up the Raspberry Pi now, we don't yet have any way of accessing it.
Create an empty file called ssh in the boot directory. This enables SSH so that you can log in remotely.
The next step is only required if you want the Raspberry Pi to connect to your wireless network. Otherwise, connect the it to your network by using a network cable.
(Optional) Create a file called wpa_supplicant.conf in the boot directory:
ctrl_interface=/var/run/wpa_supplicant
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>
network={
ssid="<Name of your WiFi>"
psk="<Password for your WiFi>"
}
All the necessary files are now on the SD card. Let's start up the Raspberry Pi.
Open up your terminal and enter the following command:
ssh pi@<ip address>
SSH warns you that the authenticity of the host can't be established. Type "yes" to continue connecting.
When asked for a password, enter the default password: raspberry.
Once you're logged in, change the default password:
passwd
Congratulations! You've now got a tiny Linux machine running that you can hide in a closet and access from your normal workstation.
Now that you've got the Raspberry Pi up and running, the next step is to install Grafana.
Add the APT key used to authenticate packages:
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
Add the Grafana APT repository:
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
Install Grafana:
sudo apt-get update
sudo apt-get install -y grafana
Grafana is now installed, but not yet running. To make sure Grafana starts up even if the Raspberry Pi is restarted, we need to enable and start the Grafana Systemctl service.
Enable the Grafana server:
sudo /bin/systemctl enable grafana-server
Start the Grafana server:
sudo /bin/systemctl start grafana-server
Grafana is now running on the machine and is accessible from any device on the local network.
Open a browser and go to http://<ip address>:3000, where the IP address is the address that you used to connect to the Raspberry Pi earlier. You're greeted with the Grafana login page.
Log in to Grafana with the default username admin, and the default password admin.
Change the password for the admin user when asked.
Congratulations, Grafana is now running on your Raspberry Pi. If the Raspberry Pi is ever restarted or turned off, Grafana will start up whenever the machine regains power.
If you want to use Grafana without having to go through a full installation process, check out Grafana Cloud, which is designed to get users up and running quickly and easily. Grafana Cloud offers a forever free plan that is genuinely useful for hobbyists, testing, and small teams.