Learning Center
Linux

Installing and Configuring Grafana

17 Apr 2025
Hostman Team
Hostman Team

Working with any IT project becomes much easier when the administrator has a wide range of metrics and monitoring data at their fingertips. It's even better when the data is presented in a clear and visual format. This is where tools like Grafana come in — an open-source solution designed to gather information from various sources and consolidate it into visual reports.

Grafana supports multiple platforms — Windows, macOS, Linux (including popular distributions like Debian, Ubuntu, CentOS, Fedora, OpenSuse, or RedHat). It can work with databases such as SQLite, MySQL, and PostgreSQL. With so many options, administrators rarely need to adapt the solution to their environment.

In this tutorial, we'll go over how to install Grafana, configure it, and work with dashboards.

Installing Grafana on CentOS Stream
Copy link

When ordering a Linux VPS, users can install any Linux operating system. Usually, this is one of the common distributions like CentOS or Ubuntu. For this example, we'll assume the OS is already installed and ready for Grafana and other utility programs.

  1. Let's import the GPG keys:
wget -q -O gpg.key https://rpm.grafana.com/gpg.key
sudo rpm --import gpg.key
  1. Create a new official repository configuration:

sudo nano /etc/yum.repos.d/grafana.repo
  1. Add the following content to the file:

[grafana]
name=grafana
baseurl=https://rpm.grafana.com
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://rpm.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
  1. Install the application:

sudo dnf install grafana
  1. Enable autostart and launch Grafana:

sudo systemctl enable grafana-server
sudo systemctl start grafana-server
  1. Check the status to ensure Grafana is running:

sudo systemctl status grafana-server

You should see a message confirming that the service is loaded and active. This step is especially useful if someone previously worked with the virtual server or installed a custom Linux build with bundled utilities.

Installing Grafana on Ubuntu
Copy link

The process is similar: we install Grafana from the official repository after preparing the system to trust the source.

Run these commands:

wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
sudo apt update
sudo apt install grafana
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
sudo systemctl status grafana-server

Firewall Configuration for Grafana
Copy link

By default, Grafana uses port 3000. Here's how to open it in different firewalls.

For iptables:

  1. Add the rule:

sudo iptables -A INPUT -p tcp --dport 3000 -m state --state NEW -j ACCEPT
  1. Save the rules so they persist after reboot:

sudo service iptables save
  1. Restart iptables to apply changes:

sudo systemctl restart iptables

For firewalld:

firewall-cmd --zone=public --add-port=3000/tcp --permanent
systemctl reload firewalld

Default Login and Password
Copy link

Grafana uses the default login/password:

  • Username: admin
  • Password: admin

If forgotten, reset it with:

grafana-cli admin reset-admin-password --homepath "/usr/share/grafana" new_password

Data Sources and Plugin Installation
Copy link

Grafana supports numerous data sources: Prometheus, Graphite, OpenTSDB, InfluxDB, and more. It also allows plugin installations to enhance functionality.

For example, to install the Zabbix plugin, run:

grafana-cli plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server

After restart, go to Configuration > Plugins and find Zabbix. After you enable it, you can configure it under Data Sources.

This same process applies to other plugins like Grafana PostgreSQL or Grafana Elasticsearch.

Working with Grafana Dashboards
Copy link

The core of Grafana is dashboards — sets of panels that visually display data. Users can create their own dashboards by clicking New Dashboard and selecting panel types.

Dashboard Types:

  • Graph – multiple metrics in one panel.
  • Stat – single metric graph.
  • Gauge – speedometer-style display.
  • Bar Gauge – vertical bar graph.
  • Table – table with multiple metrics.
  • Text – freeform text.
  • Heatmap – heatmap display.
  • Alert List – list of Grafana alerts.
  • Dashboard List – list of favorite dashboards.

You can also display logs from external sources using Grafana Logs, and export/import dashboards for reuse.

For advanced control, refer to the official documentation. You can directly edit the grafana.ini file to change:

  • Default ports
  • Log storage paths
  • Proxy settings
  • User access controls
  • Feature toggles

Conclusion
Copy link

Grafana is a powerful and flexible monitoring solution. To fully unlock its potential, experiment with dashboards, try manual config via grafana.ini, and explore third-party plugins. As an actively developed project, Grafana remains one of the top data visualization and monitoring tools.

And if you’re looking for a reliable, high-performance, and budget-friendly solution for your workflows, Hostman has you covered with Linux VPS Hosting options, including Debian VPS, Ubuntu VPS, and VPS CentOS.