首先信任 https://apt.grafana.com/ 的 GPG 公钥:
{{sudo}}wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
确保你的 apt 支持 HTTPS:
{{sudo}}apt-get install -y apt-transport-https
选择你希望安装的 Grafana 版本(与你的系统版本无关),将下方内容写入 /etc/apt/sources.list.d/grafana.list
deb [signed-by=/usr/share/keyrings/grafana.key] {{endpoint}}/apt/ {{version}} main
安装 Grafana
{{sudo}}apt-get update {{sudo}}apt-get install grafana
新建 /etc/yum.repos.d/grafana.repo
,内容为
[grafana] name=grafana baseurl={{endpoint}}/yum/rpm repo_gpgcheck=0 enabled=1 gpgcheck=0 {{^beta}} exclude=*beta* {{/beta}}
再执行
{{sudo}}yum makecache {{sudo}}yum install grafana