-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstallGrafana-RHEL-9.sh
39 lines (30 loc) · 988 Bytes
/
installGrafana-RHEL-9.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Disable subscription-manager plugin
sudo sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/subscription-manager.conf
# Install required packages: nano and wget
sudo yum install -y wget
# Download Grafana GPG key
sudo wget -q -O gpg.key https://rpm.grafana.com/gpg.key
sudo rpm --import gpg.key
# Check if the directory exists, if not create it
sudo mkdir -p /etc/yum.repos.d
# Create grafana.repo file
cat <<EOF > /etc/yum.repos.d/grafana.repo
[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
echo "Grafana repository configuration created successfully."
# Install Grafana using dnf package manager
sudo dnf install -y grafana
# Start Grafana
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
echo "Please visit http://$(curl -s ifconfig.me):3000 to access Grafana."