在鲲鹏CentOS7-ARM64环境下,成功安装配置Grafana;按照本文操作,没得问题;若有问题,欢迎评论区留言或者私信本博主!
注意,本篇文章在x86_64环境下亦可使放心使用。
说明环境:
鹏城实验室开发者云平台虚拟机
https://blog.csdn.net/frdevolcqzyxynjds/article/details/105578249
[root@pc-deeplearning-1 opt]# vim /etc/yum.repos.d/grafana.repo
[root@pc-deeplearning-1 opt]#
[root@pc-deeplearning-1 opt]# cat /etc/yum.repos.d/grafana.repo
[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
[root@pc-deeplearning-1 opt]#
[root@pc-deeplearning-1 opt]# yum install grafana
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
grafana/signature | 488 B 00:00:00
Retrieving key from https://packages.grafana.com/gpg.key
Importing GPG key 0x24098CB6:
Userid : "Grafana "
Fingerprint: 4e40 ddf6 d76e 284a 4a67 80e4 8c8c 34c5 2409 8cb6
From : https://packages.grafana.com/gpg.key
Is this ok [y/N]: y
grafana/signature | 2.9 kB 00:00:04 !!!
grafana/primary_db | 76 kB 00:00:03
Resolving Dependencies
--> Running transaction check
---> Package grafana.aarch64 0:7.1.5-1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================
Installing:
grafana aarch64 7.1.5-1 grafana 42 M
Transaction Summary
=================================================================================================================================================================================================================
Install 1 Package
Total download size: 42 M
Installed size: 142 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/aarch64/7/grafana/packages/grafana-7.1.5-1.aarch64.rpm: Header V4 RSA/SHA256 Signature, key ID 24098cb6: NOKEY=======================================- ] 4.9 MB/s | 41 MB 00:00:00 ETA
Public key for grafana-7.1.5-1.aarch64.rpm is not installed
grafana-7.1.5-1.aarch64.rpm | 42 MB 00:00:10
Retrieving key from https://packages.grafana.com/gpg.key
Importing GPG key 0x24098CB6:
Userid : "Grafana "
Fingerprint: 4e40 ddf6 d76e 284a 4a67 80e4 8c8c 34c5 2409 8cb6
From : https://packages.grafana.com/gpg.key
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : grafana-7.1.5-1.aarch64 1/1
### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server.service
### You can start grafana-server by executing
sudo /bin/systemctl start grafana-server.service
POSTTRANS: Running script
Verifying : grafana-7.1.5-1.aarch64 1/1
Installed:
grafana.aarch64 0:7.1.5-1
Complete!
[root@pc-deeplearning-1 opt]#
[root@pc-deeplearning-1 ~]# ll /etc/grafana/grafana.ini
-rw-r-----. 1 root grafana 27260 Aug 27 18:13 /etc/grafana/grafana.ini
[root@pc-deeplearning-1 ~]#
[root@pc-deeplearning-1 ~]# vim /etc/grafana/grafana.ini
[root@pc-deeplearning-1 ~]#
# 修改38行默认端口3000为6384
38 http_port = 6384
根本无法访问,所以尝试使用haproxy做一个代理
下载haproxy后(yum install -y haproxy 即可),
[root@pc-deeplearning-1 ~]# yum install -y haproxy
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package haproxy.aarch64 0:2.0.8-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================================================================================================================================
Package Arch Version Repository Size
=================================================================================================================================================================================================================
Installing:
haproxy aarch64 2.0.8-1.el7 kunpeng 1.4 M
Transaction Summary
=================================================================================================================================================================================================================
Install 1 Package
Total download size: 1.4 M
Installed size: 4.7 M
Downloading packages:
haproxy-2.0.8-1.el7.aarch64.rpm | 1.4 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : haproxy-2.0.8-1.el7.aarch64 1/1
Verifying : haproxy-2.0.8-1.el7.aarch64 1/1
Installed:
haproxy.aarch64 0:2.0.8-1.el7
Complete!
[root@pc-deeplearning-1 ~]#
[root@pc-deeplearning-1 ~]# ls /etc/haproxy/haproxy.cfg
/etc/haproxy/haproxy.cfg
[root@pc-deeplearning-1 ~]#
[root@pc-deeplearning-1 ~]# vim /etc/haproxy/haproxy.cfg
修改配置文件
8 global
9 defaults
10 timeout client 30s
11 timeout server 30s
12 timeout connect 30s
13
14 frontend MyFrontend
15 bind *:6384
16 default_backend TransparentBack_http
17
18 backend TransparentBack_http
19 mode http
20 source 0.0.0.0 usesrc client
21 server MyWebServer 本地IP:Port
[root@pc-deeplearning-1 ~]# systemctl status grafana-server
● grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: http://docs.grafana.org
[root@pc-deeplearning-1 ~]#
[root@pc-deeplearning-1 ~]# systemctl start grafana-server
Job for grafana-server.service failed because a fatal signal was delivered to the control process. See "systemctl status grafana-server.service" and "journalctl -xe" for details.
[root@pc-deeplearning-1 ~]#
启动发现失败,结果查看状态
[root@pc-deeplearning-1 ~]# systemctl status grafana-server
● grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2020-08-27 18:39:22 CST; 1min 35s ago
Docs: http://docs.grafana.org
Main PID: 14511 (grafana-server)
Tasks: 22
Memory: 51.0M
CGroup: /system.slice/grafana-server.service
└─14511 /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:default.paths.data=/va...
Aug 27 18:39:18 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:18+0800 lvl=info msg="Executing migration" logger=migrator id="add unique index user_auth_token.auth_token"
Aug 27 18:39:19 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:19+0800 lvl=info msg="Executing migration" logger=migrator id="add unique index user_auth_token.prev_auth_token"
Aug 27 18:39:20 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:20+0800 lvl=info msg="Executing migration" logger=migrator id="create cache_data table"
Aug 27 18:39:20 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:20+0800 lvl=info msg="Executing migration" logger=migrator id="add unique index cache_data.cache_key"
Aug 27 18:39:22 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:22+0800 lvl=info msg="Created default admin" logger=sqlstore user=admin
Aug 27 18:39:22 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:22+0800 lvl=info msg="Starting plugin search" logger=plugins
Aug 27 18:39:22 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:22+0800 lvl=info msg="Registering plugin" logger=plugins name="Direct Input"
Aug 27 18:39:22 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:22+0800 lvl=info msg="External plugins directory created" logger=plugins directory=/var/lib/grafana/plugins
Aug 27 18:39:22 pc-deeplearning-1 systemd[1]: Started Grafana instance.
Aug 27 18:39:22 pc-deeplearning-1 grafana-server[14511]: t=2020-08-27T18:39:22+0800 lvl=info msg="HTTP Server Listen" logger=http.server address=[::]:6384 protocol=http subUrl= socket=
[root@pc-deeplearning-1 ~]#
[root@pc-deeplearning-1 ~]# systemctl enable grafana-server
Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.
[root@pc-deeplearning-1 ~]#
[root@pc-deeplearning-1 ~]# ps -ef | grep grafana
grafana 14511 1 0 18:39 ? 00:00:01 /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:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning
root 14565 14245 0 18:42 pts/0 00:00:00 grep --color=auto grafana
[root@pc-deeplearning-1 ~]#
输入初始用户名密码(均为amdin)
登录成功,修改初始密码
参考:
官方文档:https://grafana.com/docs/grafana/latest/installation/rpm/
简书:https://www.jianshu.com/p/7e7e0d06709b
博客园:https://www.cnblogs.com/xiao987334176/p/11944558.html
csdn博客:https://blog.csdn.net/weixin_34210740/article/details/94109863
简书:https://www.jianshu.com/p/47ac39c7f5a3