How to Install Grafana on Rocky Linux 8
-
by cobra_admin
- 36
Installing Grafana
- The default Rocky Linux Repository does not contain Grafana. The first step is to add the Grafana RPM repository. Open a new repo file named grafana.repo using your preferred text editor.
$ sudo nano /etc/yum.repos.d/grafana.repo
- Populate the grafana.repo file with the following lines. Save and close the file.
[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.cr
- Update the system packages so that all the changes take effect.
$ sudo dnf update
- Run the
repolist
command below to verify that the Grafana repo is listed.$ sudo dnf repolist repo id repo name appstream Rocky Linux 8 - AppStream baseos Rocky Linux 8 - BaseOS extras Rocky Linux 8 - Extras grafana grafana
- Install Grafana by running the command below.
$ sudo dnf install grafana -y
- Start, stop, and restart the Grafana service on your server. Grafana provides a systemd unit file that makes it easy to manage the service from the command line.
$ sudo systemctl start grafana-server $ sudo systemctl stop grafana-server $ sudo systemctl restart grafana-server
- At this point, your Grafana server is running. Check the status of the service to make sure that everything is working correctly.
$ sudo systemctl status grafana-server grafana-server.service - Grafana instance Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; ve> Active: active (running) since Wed 2022-02-02 14:02:40 UTC; 58s ago
- Enable the Grafana service to start automatically during boot.
$ sudo systemctl enable --now grafana-server Executing: /usr/lib/systemd/systemd-sysv-install enable grafana-server Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /usr/lib/systemd/system/grafana-server.service.
Configuring Your Firewall for Grafana
Open the port in your firewall so you can access Grafana from another device. The process depends upon which software is running on your Linux server. This demo uses the firewalld firewall.
- By default, grafana listens on port 3000. Ensure that your grafana service listens on port 3000.
$ ss -alntup | grep grafana tcp LISTEN 0 128 *:3000 *:* users:(("grafan -server",pid=86078,fd=9))
Note: If you already have another app that uses the 3000 port, you will get an empty output from your Grafana server. You will need to change the http_port = 3000 value in the usr/share/grafana/conf/defaults.ini file to something else, such as 3001. Then restart the Grafana service.
$ sudo nano /usr/share/grafana/conf/defaults.ini $ sudo systemctl restart grafana-server
- Open port 3000 and allow the Grafana service through your firewall.
$ sudo firewall-cmd --add-port=3000/tcp --permanent
- Reload the firewall to apply all of the new changes.
$ sudo firewall-cmd --reload
- Finally, verify that the 3000 port has been opened.
$ sudo firewall-cmd --list-all
public (active) target: default icmp-block-inversion: no interfaces: eth0 eth1 sources: services: cockpit dhcpv6-client ssh ports: 3000/tcp
Accessing Grafana Web UI
Now that everything is configured, it’s time to access Grafana web UI. Open the browser and type the IP address of your Grafana server followed by:3000 to access Grafana Web UI.
- For example, if your Grafana server IP address is 192.168.1.100, then visits:
http:192.168.1.100:3000/
- On the login screen, provide the default username and password to access the Grafana dashboard.
Username: admin Password: admin
- Click Log in.
- On the next screen, provide a secure password for the Grafana dashboard. Click Submit.
After successfully logging in, you will get the Grafana Dashboard. You can now add data sources and visualize data.
Conclusion
You have successfully installed Grafana on Rocky Linux 8 and configured your firewall to allow access. At this point, you can create as many dashboards as you need and use Grafana as your visualization platform.
Installing Grafana The default Rocky Linux Repository does not contain Grafana. The first step is to add the Grafana RPM repository. Open a new repo file named grafana.repo using your preferred text editor. $ sudo nano /etc/yum.repos.d/grafana.repo Populate the grafana.repo file with the following lines. Save and close the file. [grafana] name=grafana baseurl=https://packages.grafana.com/oss/rpm repo_gpgcheck=1…
Installing Grafana The default Rocky Linux Repository does not contain Grafana. The first step is to add the Grafana RPM repository. Open a new repo file named grafana.repo using your preferred text editor. $ sudo nano /etc/yum.repos.d/grafana.repo Populate the grafana.repo file with the following lines. Save and close the file. [grafana] name=grafana baseurl=https://packages.grafana.com/oss/rpm repo_gpgcheck=1…