Grafana is a widely used open source system monitoring solution for Linux servers. It is used by PayPal, eBay, and Red Hat, for example. Grafana is a great choice for any engineer looking to use a scalable and robust dashboard monitoring tool. This monitoring tool monitors various data sources. With Grafana you can bind time series databases like Prometheus or Influx DB and relational databases like PostgreSQL or MySQL.
This tutorial shows how to install Grafana on CentOS 8.
You must log in as the root user on your system to run all administrative commands.
Installation of Grafana on CentOS 8
The Grafana installation is completed in the number of steps listed below:
Step 1: add Grafana Yum repository
To install Grafana using the Yum package manager, add the Grafana repository to the local Yum repository. To do this, open the terminal via the “Activities” section and click on the terminal symbol in the left sidebar of the CentOS 8 desktop. Now create a new file ‘grafana.repo’ in the Yum repository and run the following commands with administrator rights on the terminal application:
$ cat <<EOF | sudo tee /etc/yum.repos.d/grafana.repo [grafana] name=grafana baseurl=https://packages.grafana.com/oss/rpm repo_gpgcheck=1 enabled=1 gpgcheck=1 gpgkey=https://packages.grafana.com/gpg.key sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt EOF
Enter the sudo password and you will see the following output on the terminal:
Step 2: update the Yum repository
Update the available system packages with the following command:
$ sudo dnf makecache
All packages in your system are now updated.
Step 3: Install Grafana with dnf
Once the Grafana repository has been added and configured on your system, install Grafana by running the following command:
$ sudo dnf -y install grafana
The above command imports the GPG key and installs all the necessary Grafana packages on CentOS 8.
Once the Grafana installation is complete, you can use the following command to verify the installation and view the details of the Grafana package:
$ rpm -qi grafana
Step 4: Activate the Grafana systemd service
Systemd manages the grafana service on your system. So enable it by running the ‘systemctl’ command like this:
$ sudo systemctl enable --now grafana-server.service
Step 5: Start the Grafana systemd service
The Grafana systemd service is now activated. Start the service and then check the running or active status of the Grafana service by running the following commands:
$ systemctl start grafana-server.service
$ systemctl status grafana-server.service
Step 6: Activate firewall rules
By default, the grafana service runs on port 3000. So with the firewalld service running on your system, run the following command to allow access to port 3000 for the grafana service:
$ sudo firewall-cmd --add-port=3000/tcp --permanent
$ sudo firewall-cmd –reload
To make sure everything is working properly, use the following command:
$ sudo firewall-cmd --list-all | grep ports
Step 7: Grafana configuration files
All grafana configurations regarding port and path are saved in the configuration file ‘/etc/grafana/grafana.ini’. You can change ‘http_port = 3000’ according to your system requirements. The grafana log is written to the ‘/ var / log / grafana’ directory by default. The grafana SQLite database can be found under ‘/var/lib/grafana/grafana.db’.
Step 8: Launch Grafana on CentOS 8 from the web UI
Start the Grafana web user interface on CentOS 8. Open the browser and enter the following URL in the address bar:
http: // localhost: 3000
http: // server-ip: 3000
The Grafana web UI is displayed in your browser as follows:
Enter username = admin and password = admin to access the Grafana dashboard. The following Grafana dashboard is then displayed in the browser:
Congratulations! The Grafana installation is complete. You are now ready to use the Grafana monitoring dashboard on the CentOS 8 system.
Remove or uninstall the Grafana monitoring tool from CentOS 8
After using Grafana on your system, you can uninstall this monitoring tool dashboard from CentOS 8 by using the following command:
$ sudo dnf remove grafana
Grafana is an open source system monitoring tool for Linux servers that is widely used. These instructions will guide you through the installation of Grafana on CentOS. It’s an excellent option for any engineer looking for a scalable and reliable dashboard monitoring solution.