Installing on RPM-based Linux (CentOS, Fedora, OpenSuse, RedHat)¶

本文提供了在RPM-based Linux发行版上安装Grafana的方法,包括通过YUM直接安装、手动使用rpm安装以及通过YUM仓库安装等步骤,并介绍了安装后的配置及启动方式。

Installing on RPM-based Linux (CentOS, Fedora, OpenSuse, RedHat)

DescriptionDownload
Stable for CentOS / Fedora / OpenSuse / Redhat Linuxx86-64
Stable for CentOS / Fedora / OpenSuse / Redhat LinuxARM64
Stable for CentOS / Fedora / OpenSuse / Redhat LinuxARMv7

Read Upgrading Grafana for tips and guidance on updating an existing installation.

Install Stable

You can install Grafana using Yum directly.

$ sudo yum install <rpm package url>

Example:

$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.4-1.x86_64.rpm

Or install manually using rpm. First execute

$ wget <rpm package url>

Example:

$ wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.1.4-1.x86_64.rpm

On CentOS / Fedora / Redhat:

$ sudo yum install initscripts fontconfig
$ sudo rpm -Uvh <local rpm package>

On OpenSuse:

$ sudo rpm -i --nodeps <local rpm package>

Install via YUM Repository

Add the following to a new file at /etc/yum.repos.d/grafana.repo

[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/7/$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

There is also a testing repository if you want beta or release candidates.

baseurl=https://packagecloud.io/grafana/testing/el/7/$basearch

Then install Grafana via the yum command.

$ sudo yum install grafana

RPM GPG Key

The RPMs are signed, you can verify the signature with this public GPG key.

Package details

  • Installs binary to /usr/sbin/grafana-server
  • Copies init.d script to /etc/init.d/grafana-server
  • Installs default file (environment vars) to /etc/sysconfig/grafana-server
  • Copies configuration file to /etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name grafana-server.service
  • The default configuration uses a log file at /var/log/grafana/grafana.log
  • The default configuration specifies an sqlite3 database at /var/lib/grafana/grafana.db

Start the server (init.d service)

You can start Grafana by running:

$ sudo service grafana-server start

This will start the grafana-server process as the grafana user, which is created during package installation. The default HTTP port is 3000, and default user and group is admin.

To configure the Grafana server to start at boot time:

$ sudo /sbin/chkconfig --add grafana-server

Start the server (via systemd)

$ systemctl daemon-reload
$ systemctl start grafana-server
$ systemctl status grafana-server

Enable the systemd service to start at boot

sudo systemctl enable grafana-server.service

Environment file

The systemd service file and init.d script both use the file located at /etc/sysconfig/grafana-server for environment variables used when starting the back-end. Here you can override log directory, data directory and other variables.

Logging

By default Grafana will log to /var/log/grafana

Database

The default configuration specifies a sqlite3 database located at /var/lib/grafana/grafana.db. Please backup this database before upgrades. You can also use MySQL or Postgres as the Grafana database, as detailed on the configuration page.

Configuration

The configuration file is located at /etc/grafana/grafana.ini. Go the Configuration page for details on all those options.

Adding data sources

Server side image rendering

Server side image (png) rendering is a feature that is optional but very useful when sharing visualizations, for example in alert notifications.

If the image is missing text make sure you have font packages installed.

yum install fontconfig
yum install freetype*
yum install urw-fonts

Installing from binary tar file

Download the latest .tar.gz file and extract it. This will extract into a folder named after the version you downloaded. This folder contains all files required to run Grafana. There are no init scripts or install scripts in this package.

To configure Grafana add a configuration file named custom.ini to the conf folder and override any of the settings defined in conf/defaults.ini.

Start Grafana by executing ./bin/grafana-server web. The grafana-server binary needs the working directory to be the root install directory (where the binary and the public folder is located).

Logging in for the first time

To run Grafana open your browser and go to http://localhost:3000/. 3000 is the default http port that Grafana listens to if you haven’t configured a different port. Then follow the instructions here.

<think>好的,我现在需要帮助用户解决在基于RPMLinux发行版上安装软件的问题。用户提到了RedHat Enterprise LinuxCentOSFedoraopenSUSE这些系统。首先,我应该回想一下这些系统常用的包管理工具。记得RPM是这些系统的包管理基础,主要工具包括Yum和DNF,还有zypper在openSUSE中使用。 接下来,我需要整理安装软件的几种方法。通常,用户可以通过官方仓库直接安装,这是最方便的方式。比如使用yum install或者dnf install命令。另外,有时候软件可能不在官方仓库里,这时候可能需要添加第三方仓库,比如EPEL或者RPM Fusion,这些仓库提供了额外的软件包。用户可能需要先安装epel-release或者启用RPM Fusion仓库,然后再用yum或dnf安装。 第三种情况是用户直接下载了RPM包,这时候可以用rpm -i命令来安装,但需要注意依赖问题。如果依赖较多,手动处理会很麻烦,所以可能的话还是建议通过仓库安装。 还有一种方法是使用第三方提供的自动安装脚本,比如像GitLab提供的脚本,不过要提醒用户注意安全,确保来源可信。 然后,我需要结合用户提供的引用内容。引用[2]提到可以通过Yum仓库安装RabbitMQ,引用[3]提到了使用Yum仓库安装GitLab的例子。这些可以作为具体例子来说明如何添加仓库并安装软件。 此外,用户可能想知道不同发行版之间的差异。例如,openSUSE使用zypper而不是yum/dnf,所以需要单独说明。同时,收费和免费版本在稳定性上的区别,如引用[4]提到的收费版更稳定,可能影响软件安装时的选择。 还需要注意一些常见问题,比如依赖解决、GPG密钥的导入,以及更新缓存的重要性。比如在添加新仓库后,需要运行yum makecache或者dnf makecache来更新元数据。 最后,生成相关问题时要覆盖用户可能进一步关心的方面,比如如何解决依赖、第三方仓库推荐、手动安装与仓库安装的优劣比较,以及特定发行版如openSUSE的注意事项。</think>在基于RPMLinux发行版(如Red Hat Enterprise LinuxCentOSFedoraopenSUSE)中安装软件主要有以下方法: ### 一、通过包管理器安装 1. **Yum/DNF(RHEL/CentOS/Fedora)** - 基础命令:`sudo yum install package_name`(CentOS 7及以下) 或`sudo dnf install package_name`(Fedora/CentOS 8+) 例如安装Erlang RPM包: ```bash sudo yum install erlang # 通过预设仓库安装[^2] ``` - 添加第三方仓库(如EPEL/RPM Fusion): ```bash sudo yum install epel-release # 安装EPEL仓库 sudo yum install package_name ``` 2. **Zypper(openSUSE)** ```bash sudo zypper refresh # 更新仓库元数据 sudo zypper install package_name ``` ### 二、直接安装RPM包 1. 下载RPM文件后安装: ```bash sudo rpm -ivh package.rpm # 安装单个包 ``` 2. 自动解决依赖(需配置仓库): ```bash sudo yum localinstall package.rpm # 自动处理依赖[^3] ``` ### 三、通过第三方仓库安装 - **示例:GitLab CE安装** ```bash curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash sudo yum install gitlab-ce # 自动配置仓库并安装[^3] ``` ### 四、源码编译安装(较少用) 需安装编译工具链: ```bash sudo yum groupinstall "Development Tools" ./configure && make && sudo make install ```
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值