docs/sources/setup-grafana/installation/debian/index.md
This topic explains how to install Grafana dependencies, install Grafana on Linux Debian or Ubuntu, and start the Grafana server on your Debian or Ubuntu system.
There are multiple ways to install Grafana: using the Grafana Labs APT repository, by downloading a .deb package, or by downloading a binary .tar.gz file. Choose only one of the methods below that best suits your needs.
{{< admonition type="note" >}}
If you install via the .deb package or .tar.gz file, then you must manually update Grafana for each new version.
{{< /admonition >}}
The following video demonstrates how to install Grafana on Debian and Ubuntu as outlined in this document:
{{< youtube id="_Zk_XQSjF_Q" >}}
If you install from the APT repository, Grafana automatically updates when you run apt-get update.
| Grafana Version | Package | Repository |
|---|---|---|
| Grafana Enterprise | grafana-enterprise | https://apt.grafana.com stable main |
| Grafana Enterprise (Beta) | grafana-enterprise | https://apt.grafana.com beta main |
| Grafana OSS | grafana | https://apt.grafana.com stable main |
| Grafana OSS (Beta) | grafana | https://apt.grafana.com beta main |
{{< admonition type="note" >}} Grafana Enterprise is the recommended and default edition. It is available for free and includes all the features of the OSS edition. You can also upgrade to the full Enterprise feature set, which has support for Enterprise plugins. {{< /admonition >}}
Complete the following steps to install Grafana from the APT repository:
Install the prerequisite packages:
sudo apt-get install -y apt-transport-https wget gnupg
Import the GPG key:
sudo mkdir -p /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/grafana.asc https://apt.grafana.com/gpg-full.key
sudo chmod 644 /etc/apt/keyrings/grafana.asc
To add a repository for stable releases, run the following command:
echo "deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
To add a repository for beta releases, run the following command:
echo "deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
Run the following command to update the list of available packages:
# Updates the list of available packages
sudo apt-get update
To install Grafana OSS, run the following command:
# Installs the latest OSS release:
sudo apt-get install grafana
To install Grafana Enterprise, run the following command:
# Installs the latest Enterprise release:
sudo apt-get install grafana-enterprise
If you install Grafana manually using the deb package, then you must manually update Grafana for each new version.
Complete the following steps to install Grafana using a deb package:
Complete the following steps to install Grafana using the standalone binaries:
Navigate to the Grafana download page.
Select the Grafana version you want to install.
Select an Edition.
Depending on which system you are running, click the Linux or ARM tab on the download page.
Copy and paste the code from the download page page into your command line and run.
Create a user account for Grafana on your system:
sudo useradd -r -s /bin/false grafana
Move the unpacked binary to /usr/local/grafana:
sudo mv <DOWNLOAD PATH> /usr/local/grafana
Change the owner of /usr/local/grafana to Grafana users:
sudo chown -R grafana:users /usr/local/grafana
Create a Grafana server systemd unit file:
sudo touch /etc/systemd/system/grafana-server.service
Add the following to the unit file in a text editor of your choice:
[Unit]
Description=Grafana Server
After=network.target
[Service]
Type=simple
User=grafana
Group=users
ExecStart=/usr/local/grafana/bin/grafana server --config=/usr/local/grafana/conf/grafana.ini --homepath=/usr/local/grafana
Restart=on-failure
[Install]
WantedBy=multi-user.target
Use the binary to manually start the Grafana server:
/usr/local/grafana/bin/grafana server --homepath /usr/local/grafana
{{< admonition type="note" >}}
Manually invoking the binary in this step automatically creates the /usr/local/grafana/data directory, which needs to be created and configured before the installation can be considered complete.
{{< /admonition >}}
Press CTRL+C to stop the Grafana server.
Change the owner of /usr/local/grafana to Grafana users again to apply the ownership to the newly created /usr/local/grafana/data directory:
sudo chown -R grafana:users /usr/local/grafana
Configure the Grafana server to start at boot time using systemd.
Complete any of the following steps to uninstall Grafana.
To uninstall Grafana, run the following commands in a terminal window:
If you configured Grafana to run with systemd, stop the systemd service for Grafana server:
sudo systemctl stop grafana-server
If you configured Grafana to run with init.d, stop the init.d service for Grafana server:
sudo service grafana-server stop
To uninstall Grafana OSS:
sudo apt-get remove grafana
To uninstall Grafana Enterprise:
sudo apt-get remove grafana-enterprise
Optional: To remove the Grafana repository:
sudo rm -i /etc/apt/sources.list.d/grafana.list