In this post, I’ll walk you through the installation of Grafana on Debian 11/10/9. Grafana v9 is out and it can be installed on Ubuntu, Debian and Red Hat based Linux distributions from official Grafana package repositories.
Grafana is an open source tool which allows you to query, visualize, alert on and understand your metrics no matter where they are stored. It enables you to easily create, explore, and share dashboards with your team and foster a data-driven culture.
What is new in Grafana?
- Library panels: Allow users to build panels that can be used in multiple dashboards
- Prometheus metrics browser: Allows you to quickly find metrics and select relevant labels to build basic queries.
- Grafana alerts: Centralizes alerting information for Grafana managed alerts and alerts from Prometheus-compatible data sources in one UI and API.
- Real-time streaming: Data sources can now send real-time updates to dashboards over a websocket connection
- Bar chart visualization: A new visualization that supports categorical data
- Histogram visualization: This hidden feature of the old Graph panel is now a standalone visualization
- State timeline visualization: The State timeline visualization shows discrete state changes over time
- Time series visualization out of Beta and is now graduating to a stable state
- Download logs: When you inspect a panel, you can now download log results as a text (.txt) file.
For CentOS 7, check: How to Install Grafana on CentOS 7
Step 1: Update Debian system
Ensure your Ubuntu / Debian system is up to date.
sudo apt update && sudo apt -y full-upgrade
[ -f /var/run/reboot-required ] && sudo reboot -f
Step 2: Add Grafana APT repository
Add Grafana gpg key which allows you to install signed packages.
sudo apt install -y gnupg2 curl software-properties-common
curl -fsSL https://packages.grafana.com/gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/grafana.gpg
Then install Grafana APT repository:
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
If your system is missing , check Install add-apt-repository on Debian / Ubuntu
Once the repository is added, proceed to update your Apt repositories and install Grafana on Debian 11/10/9.
sudo apt update
sudo apt -y install grafana
Start grafana service.
sudo systemctl start grafana-server
The grafana-service
should now be running.
$ systemctl status grafana-server
● grafana-server.service - Grafana instance
Loaded: loaded (/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2023-08-16 10:15:56 UTC; 19s ago
Docs: http://docs.grafana.org
Main PID: 2568 (grafana)
Tasks: 7 (limit: 4539)
Memory: 74.1M
CPU: 3.862s
CGroup: /system.slice/grafana-server.service
└─2568 /usr/share/grafana/bin/grafana server --config=/etc/grafana/grafana.ini --pidfile=/run/grafana/grafana-server.pid --packaging=deb cfg:default.paths.logs=/var/log/grafana cfg:def>
Aug 16 10:16:00 debian11 grafana[2568]: logger=modules t=2023-08-16T10:16:00.541659794Z level=warn msg="No modules registered..."
Aug 16 10:16:00 debian11 grafana[2568]: logger=ngalert.state.manager t=2023-08-16T10:16:00.544156296Z level=info msg="Warming state cache for startup"
Aug 16 10:16:00 debian11 grafana[2568]: logger=http.server t=2023-08-16T10:16:00.544413336Z level=info msg="HTTP Server Listen" address=[::]:3000 protocol=http subUrl= socket=
Aug 16 10:16:00 debian11 grafana[2568]: logger=grafanaStorageLogger t=2023-08-16T10:16:00.544527971Z level=info msg="storage starting"
Aug 16 10:16:00 debian11 grafana[2568]: logger=ngalert.state.manager t=2023-08-16T10:16:00.544845144Z level=info msg="State cache has been initialized" states=0 duration=686.509µs
Aug 16 10:16:00 debian11 grafana[2568]: logger=ticker t=2023-08-16T10:16:00.545137498Z level=info msg=starting first_tick=2023-08-16T10:16:10Z
Aug 16 10:16:00 debian11 grafana[2568]: logger=ngalert.multiorg.alertmanager t=2023-08-16T10:16:00.557450763Z level=info msg="starting MultiOrg Alertmanager"
Aug 16 10:16:00 debian11 grafana[2568]: logger=sqlstore.transactions t=2023-08-16T10:16:00.55952219Z level=info msg="Database locked, sleeping then retrying" error="database is locked" retry=0 code>
Aug 16 10:16:00 debian11 grafana[2568]: logger=grafana.update.checker t=2023-08-16T10:16:00.68434334Z level=info msg="Update check succeeded" duration=128.81831ms
Aug 16 10:16:00 debian11 grafana[2568]: logger=plugins.update.checker t=2023-08-16T10:16:00.702657717Z level=info msg="Update check succeeded" duration=146.090834ms
Ensure the service is set to run on boot.
sudo systemctl enable grafana-server
Step 3: Access Grafana UI on Debian
Once the service has been started, you can access its web dashboard by visiting the server IP on port 3000.
If you have an active firewall, mostly ufw, allow port 3000 on the firewall.
sudo ufw allow proto tcp from any to any port 3000
Now open your browser and enter server IP address and port 3000.
Default logins are:
Username: admin
Password: admin
But you’re required to change immediately after authenticating.
Grafana Package details:
- Installs binary to
/usr/sbin/grafana-server
- Installs Init.d script to
/etc/init.d/grafana-server
- Creates default file (environment vars) to
/etc/default/grafana-server
- Installs configuration file to
/etc/grafana/grafana.ini
- Installs systemd service (if systemd is available) name
grafana-server.service
- The default configuration sets the log file at
/var/log/grafana/grafana.log
- The default configuration specifies a sqlite3 db at
/var/lib/grafana/grafana.db
- Installs HTML/JS/CSS and other Grafana files at
/usr/share/grafana
The systemd service file and init.d script both use environment vars on the file located at /etc/default/grafana-server.
Next steps include looking at Adding data sources
Step 4: Monitoring with Grafana
See our sample guides on how you can monitor your infrastructure using Grafana.
- Monitor Linux System with Grafana and Telegraf
- Monitoring Ceph Cluster with Prometheus and Grafana
- How to Monitor BIND DNS server with Prometheus and Grafana
- Monitoring MySQL / MariaDB with Prometheus in five minutes
- How to Monitor Apache Web Server with Prometheus and Grafana in 5 minutes
- How to Monitor Linux Server Performance with Prometheus and Grafana in 5 minutes