Skip to main content

How to Install and Deploy the Grafana Server

Prometheus is now collecting statistics from the clients listed in the scrape_configs section of its configuration file. However, the information can only be viewed as a raw data dump. The statistics are difficult to read and not too useful.

Grafana provides an interface for viewing the statistics collected by Prometheus. Install Grafana on the same server running Prometheus and add Prometheus as a data source. Then install one or more panels for interpreting the data. To install and configure Grafana, follow these steps.

Install some required utilities using apt.

sudo apt-get install -y apt-transport-https software-properties-common

Import the Grafana GPG key.

sudo wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key

Add the Grafana “stable releases” repository.

echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

Update the packages in the repository, including the new Grafana package.

sudo apt-get update

Install the open-source version of Grafana.

Note
To install the Enterprise edition of Grafana, use the command sudo apt-get install grafana-enterprise instead.
sudo apt-get install grafana

Reload the systemctl daemon.

sudo systemctl daemon-reload

Enable and start the Grafana server. Using systemctl enable configures the server to launch Grafana when the system boots.

sudo systemctl enable grafana-server.service
sudo systemctl start grafana-server

Verify the status of the Grafana server and ensure it is in the active state.

sudo systemctl status grafana-server

grafana-server.service - Grafana instance
Loaded: loaded (/lib/systemd/system/grafana-server.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-04-11 17:31:53 UTC; 9s ago