To install Grafana on Debian 11, follow the steps below. Grafana provides its own APT repository for Debian-based distributions, which ensures you get the latest version. This guide will show you how to install Grafana from the official repository.
Step-by-Step Guide to Installing Grafana on Debian 11
Step 1: Update Your System
As always, it's a good idea to ensure that your system is up to date before installing any new software.
sudo apt update
sudo apt upgrade
Step 2: Install Required Dependencies
Install necessary packages for adding repositories over HTTPS:
sudo apt install -y apt-transport-https software-properties-common wget
Step 3: Add the Grafana GPG Key
Download and add the Grafana GPG key, which will allow you to verify the authenticity of the Grafana package:
wget -q -O - https://packages.grafana.com/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/grafana-archive-keyring.gpg
Step 4: Add the Grafana APT Repository
Now, add the Grafana repository to your system’s sources list:
echo "deb [signed-by=/usr/share/keyrings/grafana-archive-keyring.gpg] https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list > /dev/null
Step 5: Update the APT Package List
Update your package index to include the Grafana repository:
sudo apt update
Step 6: Install Grafana
Now, install the Grafana package:
sudo apt install grafana
Step 7: Start and Enable the Grafana Service
Once Grafana is installed, you need to start its service and enable it to automatically start on boot:
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
You can verify that Grafana is running by checking its status:
sudo systemctl status grafana-server
Step 8: Configure Firewall (Optional)
If you are running a firewall on your server, you will need to allow traffic on Grafana's default port (3000). For UFW (Uncomplicated Firewall), you can do this with the following command:
sudo ufw allow 3000/tcp
Step 9: Access the Grafana Web Interface
Once Grafana is running, you can access it via your web browser. Open your browser and navigate to:
http://<your-server-ip>:3000
- The default username is admin.
- The default password is also admin.
- After the first login, Grafana will prompt you to change the default password.
Optional: Install Grafana Plugins
Grafana supports a variety of plugins for data visualization. You can install plugins by using the following command:
sudo grafana-cli plugins install <plugin-name>
After installing a plugin, restart the Grafana service:
sudo systemctl restart grafana-server
Conclusion
You now have Grafana installed and running on Debian 11. From here, you can start configuring data sources, creating dashboards, and visualizing your data.