This guide aims to equip you with the knowledge needed to install Grafana on Linux systems specifically tailored for Debian or Ubuntu. Grafana can be installed through several methods including the official Grafana Labs APT repository, directly via a .deb package, or using a binary .tar.gz file. Depending on your preference and requirements, select one method from below for installation.
Important Note
Manual updates are necessary for installations done through .deb packages or .tar.gz files for each version upgrade of Grafana.
APT Repository Installation Method
Opting for installation via the APT repository allows for automatic Grafana updates alongside your system’s regular apt-get update
process.
Grafana Versions and Repositories:
- For Grafana Enterprise and its Beta version, use
https://apt.grafana.com stable main
andhttps://apt.grafana.com beta main
respectively. - For Grafana OSS and its Beta version, the repositories are similarly
https://apt.grafana.com stable main
andhttps://apt.grafana.com beta main
.
Note: Grafana Enterprise, offered as the default edition, is free and includes all OSS features with an option to upgrade for access to additional Enterprise functionalities.
Steps for APT Repository Installation:
- Prepare Your System: Install necessary packages by executing:
sudo apt-get install -y apt-transport-https software-properties-common wget
- Import Grafana’s GPG Key: Securely import the GPG key using:
sudo mkdir -p /etc/apt/keyrings/ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
- Add Grafana Repository:
- For stable releases:
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
- For beta releases:
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
- For stable releases:
- Install Grafana: Update your package list and install Grafana or Grafana Enterprise:
- For Grafana OSS:
sudo apt-get update sudo apt-get install grafana
- For Grafana Enterprise:
sudo apt-get install grafana-enterprise
- For Grafana OSS:
Alternative Installation Methods: DEB Package or Standalone Binary
If the APT method doesn’t suit your needs, Grafana can also be installed by downloading either a DEB package or a standalone binary file.
Steps for DEB or Binary Installation:
- Visit the Grafana download page and select the desired version.
- Choose between the Enterprise or Open Source edition.
- Download the appropriate package for your system (Linux or ARM).
- Execute the provided command in your terminal to install Grafana.
Launching the Grafana Server on Debian or Ubuntu Systems
This guide details the procedure for initiating the Grafana server on your Debian or Ubuntu machine, essential for visualizing and analyzing metrics. Note that configuration adjustments may necessitate restarting the Grafana server to apply changes effectively.
Upon installation through the package, the Grafana server is set to run under the ‘grafana’ user, established during the installation process. Depending on your installation method—APT repository, .deb package, or binary .tar.gz file—starting the server varies. Here, we explore the methods to kickstart your Grafana server.
Method 1: Using systemd to Start Grafana
For installations done via the APT repository or .deb package, systemd is your go-to for managing the Grafana server process. To initiate and ensure the Grafana server is up and running, execute these commands:
sudo systemctl daemon-reload sudo systemctl start grafana-server sudo systemctl status grafana-server
To have Grafana automatically boot at system startup, enable it using:
sudo systemctl enable grafana-server.service
Launching Grafana on Ports Below 1024 with systemd
Should you need Grafana to run on a privileged port below 1024 while utilizing systemd, a unit file override is required. Set it up with:
sudo systemctl edit grafana-server.service
In the override file, adjust settings to grant the necessary capabilities, turning off PrivateUsers
to allow process capabilities within the host’s namespace.
Method 2: Starting Grafana with init.d
If your system configuration leans towards init.d, the following steps will get your Grafana server running:
sudo service grafana-server start sudo service grafana-server status
To configure the server to start on boot with init.d:
sudo update-rc.d grafana-server defaults
And to restart:
sudo service grafana-server restart
Method 3: Running the Grafana Binary Directly
When you’ve installed Grafana via a binary .tar.gz file, starting the server requires executing the binary from the root install directory. Simply navigate to where the binary resides and:
./bin/grafana-server
Alternative: Docker Usage
For those using Docker, restarting Grafana can be done with:
docker restart grafana
Or, for Docker Compose setups, update your docker-compose.yml
accordingly and utilize:
docker compose up -d docker compose restart grafana
Windows and macOS Specifics
Windows users can start Grafana with grafana.exe server
command, adjusting ports via the custom.ini
file if necessary. For macOS, the start and restart processes depend on whether Grafana was installed using Homebrew or as a standalone binary, with commands provided for each scenario.
In all, whether you’re deploying Grafana on Linux, Windows, or macOS, these instructions facilitate a smooth initiation or restart of your Grafana server, ensuring you’re set to visualize your data effectively.