Install Grafana on RHEL 9 | CentOS 9

Install Grafana on RHEL 9

Learn how to install Grafana on RHEL 9 or CentOS 9—from repository setup through installation, service management, firewall & SELinux configuration, to securing your Grafana environment.

Table of Contents

🔈Introduction

If you’re working with Grafana and running a modern enterprise Linux environment like Red Hat Enterprise Linux 9 (RHEL 9) or CentOS Stream 9 (or a compatible EL9 distribution), this guide walks you through installing Grafana in a clear, inclusive, step-by-step way. We’ll cover prerequisites, repository setup, installation, startup, initial configuration and securing your setup. At the end you’ll be ready to access the Grafana UI, add data sources, and build dashboards. Let’s dive in.


✅ Why Grafana on RHEL 9 / CentOS 9?

Grafana is a powerful open-source (with optional enterprise features) analytics and monitoring platform used to query, visualize and alert on metrics, logs and traces from many sources. It supports time-series databases like Prometheus, InfluxDB, and traditional relational stores, and offers a flexible dashboarding environment.

Choosing RHEL 9 / CentOS 9 means you have a modern, supported kernel and user-space, along with recent dependencies such as systemd, dnf, updated crypto policies and SELinux support. 

💡Note: While RHEL 9 includes a version of Grafana via official repos, the version may be older — for example as of the date of this publication, RHEL 9 ships with grafana version 10.2.6. To get the latest or Enterprise version of Grafana, you’ll typically install via Grafana’s own RPM repository. 

🔄 Step 1: Add the Grafana RPM Repository

Using Grafana’s own repository instead of relying solely on the default distribution repo ensures you get the most up-to-date version and patches. Run the following commands:

				
					wget -q -O /tmp/grafana_gpg.key https://rpm.grafana.com/gpg.key
				
			
				
					sudo rpm --import /tmp/grafana_gpg.key
				
			
				
					sudo tee /etc/yum.repos.d/grafana.repo << EOF
[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
EOF
				
			

This configures the Grafana OSS repository. If you do not intend to install the Enterprise version, you may skip this step.


🔄 Step 2: Install Grafana

Once the repo is configured, install Grafana:

				
					sudo dnf install grafana -y
				
			

If you prefer the enterprise edition:

				
					sudo dnf install grafana-enterprise -y
				
			

After installation the package will include grafana-server, grafana-cli, the web UI and default configuration in /etc/grafana/grafana.ini. The official documentation describes this method for RHEL/Fedora/EL systems. Run the following command to check the version:

				
					grafana server --version
				
			
				
					Version 10.2.6 (commit: NA, branch: main)
				
			

You should see the installed version printed (e.g., Version 10.2.6, depending on release).

🛑 Deprecation warning: The standalone ‘grafana-server’ program is deprecated and will be removed in the future. Update all uses of ‘grafana-server’ to ‘grafana server’.

🔄 Step 3: Start and Enable Grafana Service

Enable and start the Grafana service so it runs at boot:

				
					sudo systemctl enable --now grafana-server
				
			

Check status:

				
					sudo systemctl status grafana-server
				
			
				
					● grafana-server.service - Grafana instance
     Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; preset: disabled)
     Active: active (running) since Mon 2025-11-10 21:08:37 EST; 38min ago
       Docs: http://docs.grafana.org
   Main PID: 944 (grafana)
      Tasks: 18 (limit: 23109)
     Memory: 236.5M
        CPU: 3.311s
     CGroup: /system.slice/grafana-server.service
             ├─ 944 /usr/sbin/grafana server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:de>
             └─1522 /usr/share/performancecopilot-pcp-app/datasources/redis/pcp_redis_datasource_linux_amd64
...omitted for brevity...
				
			

You should see something like: “active (running)”. Then, verify the listening port (default is 3000):

				
					ss -ntlp | grep 3000
				
			
				
					LISTEN 0      4096               *:3000            *:*    users:(("grafana",pid=944,fd=12))
				
			

If it shows LISTEN and the process "grafana" then we are good.


🔄 Step 4: Configure Firewall & SELinux

🔹 Firewall (using firewalld)

If you’re using firewalld, open port 3000:

				
					sudo firewall-cmd --permanent --add-port=3000/tcp && sudo firewall-cmd --reload
				
			

🔹 SELinux

By default, SELinux should allow the grafana-server service to bind port 3000 (since it’s using the default settings), but if you have customized SELinux policies, ensure grafana-server is allowed to open network ports. If you see AVC denials in audit.log, you may need SELinux adjustments (e.g., audit2allow).


🔄 Step 5: Initial Login and Basic Configuration

Access the Grafana web UI by opening (http://<your_server_IP_or_hostname>:3000):

Install Grafana on RHEL 9

Photo by admingeek from Infotechys

The default login credentials are:

  • Username: admin
  • Password: admin

You will be prompted to change the password at first login. You may do so or skip to continue with default credentials.

Install Grafana on RHEL 9

Photo by admingeek from Infotechys

After login, you’ll land on the Grafana UI. Some initial steps to consider:

  • Go to Configuration → Data sources, and add your source (Prometheus, InfluxDB, Loki, etc.). Or, click on the Data Sources card on the Welcome page to continue.
  • Go to Alerting and define notification channels if you want alerting.
  • Customize Organization settings, change the default theme, set home dashboard, etc.
  • In Configuration → Server Admin → Settings, confirm the root_url, http_port, serve_from_sub_path, etc if you are using a reverse proxy. The config file lives at /etc/grafana/grafana.ini.
Install Grafana on RHEL 9

Photo by admingeek from Infotechys

Tip: To change the default admin password via CLI
				
					sudo grafana-cli admin reset-admin-password NewP@sswordHere
				
			

🔄 Step 6: (Optional) Secure Grafana for Production

For production usage, consider the following best practices:

  • Use HTTPS: Configure a reverse proxy (e.g., Nginx, Apache) with SSL/TLS and forward traffic to Grafana on port 3000 (or change Grafana to listen on 443). Example Nginx setup:
				
					# nginx.conf

server {
    listen 443 ssl;
    server_name grafana.example.com;

    ssl_certificate /etc/ssl/certs/grafana.pem;
    ssl_certificate_key /etc/ssl/private/grafana.key;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
				
			
  • Enable authentication/SSO: Integrate with LDAP, OAuth or SAML as required.
  • Disable anonymous access: In /etc/grafana/grafana.ini, set allow_anonymous = false.
  • Backup Grafana’s database and config: By default Grafana uses an embedded SQLite database (sufficient for small setups). For larger deployments use MySQL or PostgreSQL.
  • Apply updates regularly: Keep Grafana and its plugins updated.
  • Limit access: Use firewall rules or VPN so only authorized users can reach Grafana.
  • Audit dashboards, users and data sources: Remove stale access and monitor usage.

🔄 Step 7: Quick Reference Table

StepActionCommand / Location
1Add Grafana repoSee commands under “Step 1” above
2Install Grafanasudo dnf install grafana
3Start & enable servicesudo systemctl enable --now grafana-server
4Open firewall portsudo firewall-cmd --add-port=3000/tcp --permanent
5Access web UIhttp://<hostname>:3000
6Change default credentialsUse web UI or grafana-cli
7Secure for productionUse reverse proxy + SSL, disable anonymous, etc

🧰 Troubleshooting Common Issues

  • Cannot connect to repository or GPG key failure: Check network connectivity, ensure TLS/SSL certs are valid, verify the baseurl in /etc/yum.repos.d/grafana.repo. Look for errors like “GPG check failed”.
  • Grafana logs show errors: Check /var/log/grafana/grafana.log for clues.
  • Port 3000 not accessible: Confirm systemctl status, check firewall, ensure SELinux not blocking.
  • Plugins not loading: Use grafana-cli plugins ls and then restart service (systemctl restart grafana-server). Some users report issues installing plugins on EL9 with new versions.

📌 Summary

By following this guide, you’ve configured a modern EL9 host (RHEL 9 or CentOS 9) with the official Grafana RPM repository, installed Grafana, started it, and performed the basic configuration steps. You’re now ready to connect data sources and build dashboards. The steps covered ensure you get a current version of Grafana, and the security tips help transition from proof-of-concept to production readiness.

Did you find this article helpful? Your feedback is invaluable to us! Feel free to share this post with those who may benefit, and let us know your thoughts in the comments section below.


📕 Related Posts