---
category: help
layout: help
mirrorid: grafana
---

# Grafana 软件仓库镜像使用帮助

<form class="form-inline">
<div class="form-group">
	<label>是否使用 HTTPS</label>
	<select id="http-select" class="form-control content-select" data-target="#content-0,#content-1,#content-2,#content-3,#content-4,#content-5">
	  <option data-http_protocol="https://" selected>是</option>
	  <option data-http_protocol="http://">否</option>
	</select>
</div>
</form>


<form class="form-inline">
<div class="form-group">
	<label>是否使用 sudo</label>
	<select id="sudo-select" class="form-control content-select" data-target="#content-0,#content-1,#content-2,#content-3,#content-4,#content-5">
	  <option data-sudo="sudo " selected>是</option>
	  <option data-sudo="">否</option>
	</select>
</div>
</form>


### Debian / Ubuntu 用户

首先信任 https://apt.grafana.com/ 的 GPG 公钥：



{% raw %}
<script id="template-0" type="x-tmpl-markup">
{{sudo}}wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-0" data-template="#template-0" data-select="#http-select,#sudo-select">
</code>
</pre>


确保你的 apt 支持 HTTPS:



{% raw %}
<script id="template-1" type="x-tmpl-markup">
{{sudo}}apt-get install -y apt-transport-https
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-1" data-template="#template-1" data-select="#http-select,#sudo-select">
</code>
</pre>


选择你希望安装的 Grafana 版本（与你的 Debian/Ubuntu 系统版本无关），文本框中内容写进 `/etc/apt/sources.list.d/grafana.list`



<form class="form-inline">
<div class="form-group">
  <label>Grafana 版本：</label>
    <select id="select-2-0" class="form-control content-select" data-target="#content-2">
      <option data-version="stable" selected>Stable</option>
      <option data-version="beta">Beta</option>
    </select>
</div>
</form>

{% raw %}
<script id="template-2" type="x-tmpl-markup">
deb [signed-by=/usr/share/keyrings/grafana.key] {{http_protocol}}{{mirror}}/apt/ {{version}} main
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-2" data-template="#template-2" data-select="#http-select,#sudo-select,#select-2-0">
</code>
</pre>



安装 Grafana



{% raw %}
<script id="template-3" type="x-tmpl-markup">
{{sudo}}apt-get update
{{sudo}}apt-get install grafana
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-3" data-template="#template-3" data-select="#http-select,#sudo-select">
</code>
</pre>


### Centos / Redhat 用户

新建 `/etc/yum.repos.d/grafana.repo`，内容为



{% raw %}
<script id="template-4" type="x-tmpl-markup">
[grafana]
name=grafana
baseurl={{http_protocol}}{{mirror}}/yum/rpm
repo_gpgcheck=0
enabled=1
gpgcheck=0
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-4" data-template="#template-4" data-select="#http-select,#sudo-select">
</code>
</pre>


如果要避免安装 beta 版本，需要新增一行

```ini
exclude=*beta*
```

再执行



{% raw %}
<script id="template-5" type="x-tmpl-markup">
{{sudo}}yum makecache
{{sudo}}yum install grafana
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-5" data-template="#template-5" data-select="#http-select,#sudo-select">
</code>
</pre>


