Step-by-Step Guide
- Update the Package Index
Open a terminal and update the package index to ensure you have the latest information about available packages:
sudo yum update -y
- Add the Grafana Repository
Create a repository file for Grafana:
sudo nano /etc/yum.repos.d/grafana.repo
Add the following content to 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.crt
- Install Grafana
Install Grafana using theyum
package manager:
sudo yum install grafana -y
- Start and Enable Grafana
Start the Grafana service:
sudo systemctl start grafana-server
Enable Grafana to start on boot:
sudo systemctl enable grafana-server
- Verify Grafana Installation
Check the Grafana service status to ensure it is running:
sudo systemctl status grafana-server
If Grafana is running, you should see an active (running) status.
- Access the Grafana Web Interface
Open your web browser and navigate tohttp://your_server_ip:3000
. You should see the Grafana login screen. - Log In to Grafana
The default username and password for Grafana are bothadmin
. Log in using these credentials. You will be prompted to change the default password after the first login. - Add a Data Source
After logging in, you need to add a data source. Click on the gear icon (Configuration) on the left sidebar, then select “Data Sources” and click “Add data source”. Select your preferred data source type (e.g., Prometheus, MySQL, PostgreSQL) and configure the connection settings. - Create a Dashboard
To create a new dashboard, click on the plus icon (+) on the left sidebar, then select “Dashboard” and click “Add new panel”. You can add various panels (graphs, tables, etc.) and configure them to display data from your data source. - Install Grafana Plugins (Optional)
Grafana supports various plugins. To install a plugin, use the Grafana CLI. For example, to install thegrafana-piechart-panel
plugin:sudo grafana-cli plugins install grafana-piechart-panel
Restart Grafana to apply the changes:sudo systemctl restart grafana-server
- Configure Grafana (Optional)
You can configure Grafana settings by editing the Grafana configuration file located at/etc/grafana/grafana.ini
. After making changes, restart Grafana to apply them:sudo nano /etc/grafana/grafana.ini sudo systemctl restart grafana-server
- Secure Grafana (Optional)
For additional security, consider enabling HTTPS for Grafana. Obtain an SSL certificate (e.g., using Let’s Encrypt) and configure Grafana to use it by editing the configuration file:ini
[server]
protocol = https
cert_file = /path/to/your/cert.crt
cert_key = /path/to/your/cert.key