1

How to Install Grafana on Rocky Linux 8

 2 years ago
source link: https://www.vultr.com/docs/how-to-install-grafana-on-rocky-linux-8
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
<?xml encoding="utf-8" ??>

Grafana is a great open-source data visualization and monitoring tool that can be installed on Rocky Linux 8. It has a wide variety of features that make it perfect for monitoring your server performance and activity.

With Grafana, you can quickly see which services are running on your server and how they’re performing. You can also see detailed information about CPU usage, memory usage, and disk space usage so you can keep your server running smoothly.

This guide explains how to install Grafana on Rocky Linux 8.

Prerequisites

Installing Grafana

  1. 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
    
  2. 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
    
  3. Update the system packages so that all the changes take effect.

    $ sudo dnf update
    
  4. 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
    
  5. Install Grafana by running the command below.

    $ sudo dnf install grafana -y
    
  6. 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 
    
  7. 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
    
  8. 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.

  1. 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  
    
  2. Open port 3000 and allow the Grafana service through your firewall.

    $ sudo firewall-cmd --add-port=3000/tcp --permanent
    
  3. Reload the firewall to apply all of the new changes.

    $ sudo firewall-cmd --reload
    
  4. 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.

  1. For example, if your Grafana server IP address is 192.168.1.100, then visits:

    http:192.168.1.100:3000/
    
  2. On the login screen, provide the default username and password to access the Grafana dashboard.

    Username: admin
    
    Password: admin
    
  3. Click Log in.

  4. 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.

More Information

Please refer to the official documentation for more information.

Want to contribute?

You could earn up to $600 by adding new articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK