云网牛站
所在位置:首页 > Linux云服务器 > 在Ubuntu 18.04系统中安装Grafana 6的方法

在Ubuntu 18.04系统中安装Grafana 6的方法

2019-02-01 10:47:50作者:戴均力稿源:云网牛站

本文介绍在Ubuntu 18.04系统中安装Grafana 6的方法,同时该方法适用于基于Ubuntu、Debian和Red Hat的Linux发行版。如果不是使用deb包的Linux系统就去下载源码包或其它支持的包,安装方法大致是一样的。

 

一、更新Ubuntu 18.04系统

运行以下命令,使得你的Ubuntu 18.04系统是最新的:

sudo apt-get update

sudo apt-get upgrade

sudo reboot

 

二、下载并安装Grafana 6

使用wget命令下载Grafana 6的beta版,其它版本请到grafana网站下载:

sudo apt-get -y install wget

wget https://dl.grafana.com/oss/release/grafana_6.0.0-beta1_amd64.deb 

sudo dpkg -i grafana_6.0.0-beta1_amd64.deb

如果你收到如下错误:

$ sudo dpkg -i grafana_6.0.0-beta1_amd64.deb 

Selecting previously unselected package grafana.

(Reading database … 105291 files and directories currently installed.)

Preparing to unpack grafana_6.0.0-beta1_amd64.deb …

Unpacking grafana (6.0.0-beta1) …

dpkg: dependency problems prevent configuration of grafana:

grafana depends on libfontconfig; however:

Package libfontconfig is not installed.

dpkg: error processing package grafana (--install):

dependency problems - leaving unconfigured

Processing triggers for systemd (237-3ubuntu10.11) …

Processing triggers for ureadahead (0.100.0-20) …

Errors were encountered while processing:

grafana

通过运行以下命令安装缺少的依赖项:

sudo apt-get -f install

然后重新运行安装:

$ sudo dpkg -i grafana_6.0.0-beta1_amd64.deb 

(Reading database … 107288 files and directories currently installed.)

Preparing to unpack grafana_6.0.0-beta1_amd64.deb …

Unpacking grafana (6.0.0-beta1) over (6.0.0-beta1) …

Setting up grafana (6.0.0-beta1) …

Restarting grafana-server service… OK

Processing triggers for systemd (237-3ubuntu10.11) …

Processing triggers for ureadahead (0.100.0-20) …

安装后应自动启动grafana服务:

$ systemctl status grafana-server

grafana-server.service - Grafana instance

Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled)

Active: active (running) since Thu 2019-01-31 10:57:11 PST; 8min ago

Docs: http://docs.grafana.org

Main PID: 1616 (grafana-server)

Tasks: 10 (limit: 1110)

CGroup: /system.slice/grafana-server.service

    `-1616 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=deb cfg:default. 

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing PluginManager" logger=server

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Starting plugin search" logger=plugins

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Plugin dir created" logger=plugins dir=/var/lib/grafana/plugin

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing CleanUpService" logger=server

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing NotificationService" logger=server

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing ProvisioningService" logger=server

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=eror msg="Can't read alert notification provisioning files from director

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing TracingService" logger=server

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="Initializing Stream Manager"

Jan 31 10:57:17 ubuntu-01 grafana-server[1616]: t=2019-01-31T10:57:17-0800 lvl=info msg="HTTP Server Listen" logger=http.server address=0.0.0.0:3000 pr

确保将服务设置为在引导时运行:

sudo systemctl enable grafana-server

 

三、访问Grafana 6 UI

服务启动后,你可以通过访问端口3000上的服务器IP来访问其Web仪表板:

在Ubuntu 18.04系统中安装Grafana 6的方法

注:默认登录用户名和密码都是admin。

但是你需要在验证后立即更改:

在Ubuntu 18.04系统中安装Grafana 6的方法

至此,成功访问了Grafana 6 UI,也意味着安装Grafana 6全部完成了,你可以采用Grafana与Telegraf来监控Linux操作系统

 

相关主题

在Ubuntu 18.04/Debian 9上安装Grafana的方法

精选文章
热门文章