Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aos
GitHub Repository: aos/grafana-agent
Path: blob/main/docs/sources/static/set-up/install-agent-linux.md
4096 views
---
title: Install static mode on Linux weight: 115 aliases: - ../../set-up/install-agent-linux/
---

Install static mode on Linux

Install Grafana Agent and get it up and running on Linux.

Install on Debian or Ubuntu

  1. If your distribution supports the signed-by option, open a terminal and enter:

$ mkdir -p /etc/apt/keyrings/ $ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg $ echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list

Otherwise, with the deprecated apt-key command:

$ echo "deb https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list $ wget -q -O - https://apt.grafana.com/gpg.key | apt-key add -
  1. After you add the repository, update package list:

sudo apt-get update
  1. Install Grafana Agent:

sudo apt-get install grafana-agent

Install on RPM-based Linux (CentOS, Fedora, OpenSuse, Red Hat)

  1. Manually create a new .repo file inside /etc/yum.repos.d using a text editor:

$ sudo nano /etc/yum.repos.d/grafana.repo [grafana] name=grafana baseurl=https://rpm.grafana.com repo_gpgcheck=1 enabled=1 gpgcheck=1 gpgkey=https://rpm.grafana.com/gpg.key sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt
  1. Verify that the repository is properly configured using yum-config-manager:

yum-config-manager grafana
  1. Install Grafana Agent:

sudo yum install grafana-agent

Operation guide

The Grafana Agent will be configured a systemd service after using the installation methods explained in the previous sections.

Start the Agent

To run the service you just need to type:

sudo systemctl start grafana-agent

You can check the status of the running agent typing:

sudo systemctl status grafana-agent

Alternately, you can configure the Grafana Agent to restart at boot:

sudo systemctl enable grafana-agent.service

Editing the Agent's config file

By default, the config file is located in /etc/grafana-agent.yaml. After editing the file with the desired config, you need to restart the agent running:

sudo systemctl restart grafana-agent

Check the logs of running Agent

You can check the logs of running agent typing:

sudo journalctl -u grafana-agent Sep 02 14:33:28 grafana systemd[1]: Started Monitoring system and forwarder. Sep 02 14:33:28 grafana grafana-agent[1633180]: ts=2022-09-02T12:33:28Z level=info caller=traces/traces.go:143 msg="Traces Logger I> Sep 02 14:37:45 grafana systemd[1]: Stopping Monitoring system and forwarder...