How to Install Grafana on Debian 12

|
Last Updated:
|
|
Install Grafana on Debian 12

In this guide, we will provide step-by-step instructions on how to install Grafana on Debian 12. Grafana is a powerful open-source analytics and visualization platform that allows you to monitor and analyze your data in real-time. By following the installation process outlined below, you will be able to seamlessly set up Grafana on your Debian 12 system.

Installing Grafana on Debian 12

There exist different editions of Grafana. There is Grafana Enterprise and Grafana opensource (OSS).

We will be installing Grafana OSS version in this guide.

Grafana can be installed using the DEB binary or directly from the APT repository.

Run System Update

Before you can proceed to install Grafana, ensure that your system packages are up-to-date.

sudo apt update

Installing Grafana using DEB Package

To install Grafana using DEB binary package;

Download Grafana Binary Installer

  • Navigate to Grafana downloads page;
  • Select the current release version of Grafana
  • Select the edition, Enterprise or OSS (this guide installs OSS)
  • Execute the installer on the system you are installing Grafana on.

As of this writing, Grafana version 10.1.4.

Thus, replace the value of VER variable below with the current release version number;

VER=10.1.4
wget https://dl.grafana.com/oss/release/grafana_${VER}_amd64.deb

Verify Integrity of the Grafana Binary Installer

Once the download is done, verify the integrity of the downloaded package by calculating its checksum and comparing it to the one provided on the downloads page;

sha256sum grafana_${VER}_amd64.deb 

Compare the resulting hash value with the value on the download’s page.

ENSURE the hash values match!

Install Grafana using DEB Binary on Debian 12

If all is well, proceed to install Grafana as shown below;

sudo apt install ./grafana_${VER}_amd64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'grafana' instead of './grafana_10.1.4_amd64.deb'
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libfontconfig1 musl
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core grafana libfontconfig1 musl
0 upgraded, 5 newly installed, 0 to remove and 8 not upgraded.
Need to get 2,174 kB/104 MB of archives.
After this operation, 380 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bookworm/main amd64 fonts-dejavu-core all 2.37-6 [1,068 kB]
Get:2 http://deb.debian.org/debian bookworm/main amd64 fontconfig-config amd64 2.14.1-4 [315 kB]
Get:3 http://deb.debian.org/debian bookworm/main amd64 libfontconfig1 amd64 2.14.1-4 [386 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 musl amd64 1.2.3-1 [406 kB]
Get:5 /root/grafana_10.1.4_amd64.deb grafana amd64 10.1.4 [102 MB]
Fetched 2,174 kB in 1s (3,305 kB/s)
Preconfiguring packages ...
Selecting previously unselected package fonts-dejavu-core.
(Reading database ... 36275 files and directories currently installed.)
Preparing to unpack .../fonts-dejavu-core_2.37-6_all.deb ...
Unpacking fonts-dejavu-core (2.37-6) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../fontconfig-config_2.14.1-4_amd64.deb ...
Unpacking fontconfig-config (2.14.1-4) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../libfontconfig1_2.14.1-4_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.14.1-4) ...
Selecting previously unselected package musl:amd64.
Preparing to unpack .../musl_1.2.3-1_amd64.deb ...
Unpacking musl:amd64 (1.2.3-1) ...
Selecting previously unselected package grafana.
Preparing to unpack /root/grafana_10.1.4_amd64.deb ...
Unpacking grafana (10.1.4) ...
Setting up fonts-dejavu-core (2.37-6) ...
Setting up musl:amd64 (1.2.3-1) ...
Setting up fontconfig-config (2.14.1-4) ...
Setting up libfontconfig1:amd64 (2.14.1-4) ...
Setting up grafana (10.1.4) ...
Adding system user `grafana' (UID 102) ...
Adding new user `grafana' (UID 102) with group `grafana' ...
Not creating home directory `/usr/share/grafana'.
### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd
 sudo /bin/systemctl daemon-reload
 sudo /bin/systemctl enable grafana-server
### You can start grafana-server by executing
 sudo /bin/systemctl start grafana-server
Processing triggers for man-db (2.11.2-2) ...
Processing triggers for libc-bin (2.36-9+deb12u1) ...

Installing Grafana from APT Repository

To install Grafana from APT repository;

Install Grafana OSS APT repository by running the command below;

sudo apt install software-properties-common curl gnupg2 -y
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee  /etc/apt/sources.list.d/grafana.list

Install Grafana OSS APT repo GPG signing key.

curl -s https://packages.grafana.com/gpg.key | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/grafana.gpg

Install Grafana from APT Repository on Debian 12

After that, re-synchronize your system packages to the latest versions and install Grafana.

sudo apt update
sudo apt install grafana

Verify Grafana Installation

Verify the installed version of Grafana.

apt show grafana
Package: grafana
Version: 10.1.4
Priority: optional
Section: default
Maintainer: [email protected]
Installed-Size: 375 MB
Depends: adduser, libfontconfig1, musl
Homepage: https://grafana.com
License: AGPLv3
Vendor: "Grafana Labs"
Download-Size: 102 MB
APT-Manual-Installed: yes
APT-Sources: https://packages.grafana.com/oss/deb stable/main amd64 Packages
Description: Grafana

Running Grafana on Debian 12

Once the installation is done, reload systemd unit configuration files and start and enable Grafana to run on system boot.

sudo systemctl daemon-reload
sudo systemctl enable grafana-server --now

You can check the status;

systemctl status grafana-server
● grafana-server.service - Grafana instance
     Loaded: loaded (/lib/systemd/system/grafana-server.service; enabled; preset: enabled)
     Active: active (running) since Wed 2023-10-04 12:49:42 EDT; 8min ago
       Docs: http://docs.grafana.org
   Main PID: 7738 (grafana)
      Tasks: 13 (limit: 2304)
     Memory: 105.3M
        CPU: 6.723s
     CGroup: /system.slice/grafana-server.service
             └─7738 /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:default.paths.da>

Oct 04 12:52:04 debian grafana[7738]: logger=modules t=2023-10-04T12:52:04.887098665-04:00 level=info msg="All modules healthy" modules="[provisioning background-services http-server secret-migrator]"
Oct 04 12:52:04 debian grafana[7738]: logger=ngalert.state.manager t=2023-10-04T12:52:04.887690829-04:00 level=info msg="Warming state cache for startup"
Oct 04 12:52:04 debian grafana[7738]: logger=ngalert.state.manager t=2023-10-04T12:52:04.888708392-04:00 level=info msg="State cache has been initialized" states=0 duration=1.01291ms
Oct 04 12:52:04 debian grafana[7738]: logger=ngalert.scheduler t=2023-10-04T12:52:04.889174027-04:00 level=info msg="Starting scheduler" tickInterval=10s
Oct 04 12:52:04 debian grafana[7738]: logger=ticker t=2023-10-04T12:52:04.889799448-04:00 level=info msg=starting first_tick=2023-10-04T12:52:10-04:00
Oct 04 12:52:04 debian grafana[7738]: logger=grafanaStorageLogger t=2023-10-04T12:52:04.895448725-04:00 level=info msg="storage starting"
Oct 04 12:52:04 debian grafana[7738]: logger=ngalert.multiorg.alertmanager t=2023-10-04T12:52:04.898749478-04:00 level=info msg="Starting MultiOrg Alertmanager"
Oct 04 12:52:05 debian grafana[7738]: logger=grafana.update.checker t=2023-10-04T12:52:05.816085002-04:00 level=info msg="Update check succeeded" duration=922.559943ms
Oct 04 12:52:05 debian grafana[7738]: logger=plugins.update.checker t=2023-10-04T12:52:05.834322446-04:00 level=info msg="Update check succeeded" duration=940.440361ms
Oct 04 12:53:38 debian grafana[7738]: logger=infra.usagestats t=2023-10-04T12:53:38.90452924-04:00 level=info msg="Usage stats are ready to report"

You can check the logs on;

tail -f /var/log/grafana/grafana.log

Access Grafana UI

Grafana listens on TCP port 3000 by default. It might take a few minutes for the service to fully come up.

ss -altnp | grep grafana
LISTEN 0      4096               *:3000            *:*    users:(("grafana",pid=7738,fd=11))

To access Grafana UI, navigate to the browser and enter the address, http://localhost:3000.

To access Grafana from an externally, use the address, http://grafana-server-IP:3000.

However, for external access, you need to open TCP port 3000 on UFW if it is running.

sudo ufw allow 3000/tcp

If using iptables;

sudo iptables -I INPUT -p tcp -m tcp --dport 3000 -j ACCEPT

Login as admin for both username and password.

Install Grafana on Debian 12

Once you login, you will be prompted to change the password.

You can choose to keep the default credentials and compromise the security of your Grafana or do change the password and proceed to Grafana dashboard.

grafana dashboard

On the left menu, you can explore more about Grafana.

grafana menu

There you go. You have successfully installed Grafana on Debian 12 server. Enjoy

See our other related guides by following the links below;

Install and Setup TIG Stack on Fedora 30

Install Elastic Stack 7 on Ubuntu 18.04/Debian 9.8

Install Graylog 3.0 on CentOS 7

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Kifarunix
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment