grafana/docs/sources/setup-grafana/installation/debian.md

189 lines
7.7 KiB
Markdown
Raw Normal View History

---
aliases:
- /docs/grafana/latest/installation/debian/
- /docs/grafana/latest/installation/installation/debian/
- /docs/grafana/latest/setup-grafana/installation/debian/
description: Install guide for Grafana on Debian or Ubuntu
title: Install on Debian or Ubuntu
weight: 100
---
# Install on Debian or Ubuntu
2020-07-14 16:07:19 -05:00
This page explains how to install Grafana dependencies, download and install Grafana, get the service up and running on your Debian or Ubuntu system, and also describes the installation package details.
2017-04-28 03:58:26 -05:00
## Note on upgrading
While the process for upgrading Grafana is very similar to installing Grafana, there are some key backup steps you should perform. Read [Upgrading Grafana]({{< relref "../upgrade-grafana/" >}}) for tips and guidance on updating an existing installation.
> **Note:** You can use [Grafana Cloud](https://grafana.com/products/cloud/features/#cloud-logs) to avoid the overhead of installing, maintaining, and scaling your observability stack. The free forever plan includes Grafana, 10K Prometheus series, 50 GB logs, and more.[Create a free account to get started](https://grafana.com/auth/sign-up/create-user?pg=docs-grafana-install&plcmt=in-text).
## 1. Download and install
2017-09-14 04:28:59 -05:00
You can install Grafana using our official APT repository, by downloading a `.deb` package, or by downloading a binary `.tar.gz` file.
### Install from APT repository
2018-02-05 09:02:17 -06:00
If you install from the APT repository, then Grafana is automatically updated every time you run `apt-get update`.
2018-04-20 06:23:45 -05:00
| Grafana Version | Package | Repository |
| ------------------------- | ------------------ | --------------------------------------------------------- |
| Grafana Enterprise | grafana-enterprise | `https://packages.grafana.com/enterprise/deb stable main` |
| Grafana Enterprise (Beta) | grafana-enterprise | `https://packages.grafana.com/enterprise/deb beta main` |
| Grafana OSS | grafana | `https://packages.grafana.com/oss/deb stable main` |
| Grafana OSS (Beta) | grafana | `https://packages.grafana.com/oss/deb beta main` |
> **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](https://grafana.com/products/enterprise/?utm_source=grafana-install-page), which has support for [Enterprise plugins](https://grafana.com/grafana/plugins/?enterprise=1&utcm_source=grafana-install-page).
#### To install the latest Enterprise edition:
```bash
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
sudo wget -q -O /usr/share/keyrings/grafana.key https://packages.grafana.com/gpg.key
```
Add this repository for stable releases:
```bash
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/enterprise/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
```
Add this repository if you want beta releases:
```bash
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/enterprise/deb beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
```
After you add the repository:
```bash
sudo apt-get update
sudo apt-get install grafana-enterprise
2019-01-08 09:45:04 -06:00
```
#### To install the latest OSS release:
```bash
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
sudo wget -q -O /usr/share/keyrings/grafana.key https://packages.grafana.com/gpg.key
```
Add this repository for stable releases:
```bash
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
```
Add this repository if you want beta releases:
```bash
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://packages.grafana.com/oss/deb beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
```
After you add the repository:
```bash
sudo apt-get update
sudo apt-get install grafana
```
### Install .deb package
If you install the `.deb` package, then you will need to manually update Grafana for each new version.
1. On the [Grafana download page](https://grafana.com/grafana/download), select the Grafana version you want to install.
- The most recent Grafana version is selected by default.
- The **Version** field displays only finished releases. If you want to install a beta version, click **Nightly Builds** and then select a version.
1. Select an **Edition**.
- **Enterprise** - Recommended download. Functionally identical to the open source version, but includes features you can unlock with a license if you so choose.
- **Open Source** - Functionally identical to the Enterprise version, but you will need to download the Enterprise version if you want Enterprise features.
1. Depending on which system you are running, click **Linux** or **ARM**.
1. Copy and paste the code from the installation page into your command line and run. It follows the pattern shown below.
```bash
sudo apt-get install -y adduser
wget <.deb package url>
sudo dpkg -i grafana<edition>_<version>_amd64.deb
```
## Install from binary .tar.gz file
2020-07-14 16:07:19 -05:00
Download the latest [`.tar.gz` file](https://grafana.com/grafana/download?platform=linux) and extract it. The files extract into a folder named after the Grafana version downloaded. This folder contains all files required to run Grafana. There are no init scripts or install scripts in this package.
```bash
wget <tar.gz package url>
sudo tar -zxvf <tar.gz package>
```
## 2. Start the server
This starts the `grafana-server` process as the `grafana` user, which was created during the package installation.
If you installed with the APT repository or `.deb` package, then you can start the server using `systemd` or `init.d`. If you installed a binary `.tar.gz` file, then you need to execute the binary.
### Start the server with systemd
To start the service and verify that the service has started:
2015-04-13 01:14:13 -05:00
```bash
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
```
Configure the Grafana server to start at boot:
2015-04-13 01:14:13 -05:00
```bash
sudo systemctl enable grafana-server.service
```
2015-04-13 01:14:13 -05:00
#### Serving Grafana on a port < 1024
{{< docs/shared "systemd/bind-net-capabilities.md" >}}
### Start the server with init.d
To start the service and verify that the service has started:
```bash
sudo service grafana-server start
sudo service grafana-server status
```
2015-04-13 01:14:13 -05:00
Configure the Grafana server to start at boot:
2015-04-13 01:14:13 -05:00
```bash
sudo update-rc.d grafana-server defaults
```
### Execute the binary
The `grafana-server` binary .tar.gz needs the working directory to be the root install directory where the binary and the `public` folder are located.
Start Grafana by running:
```bash
./bin/grafana-server web
```
## Package details
- Installs binary to `/usr/sbin/grafana-server`
- Installs Init.d script to `/etc/init.d/grafana-server`
- Creates default file (environment vars) to `/etc/default/grafana-server`
- Installs configuration file to `/etc/grafana/grafana.ini`
- Installs systemd service (if systemd is available) name `grafana-server.service`
- The default configuration sets the log file at `/var/log/grafana/grafana.log`
- The default configuration specifies a SQLite3 db at `/var/lib/grafana/grafana.db`
- Installs HTML/JS/CSS and other Grafana files at `/usr/share/grafana`
2015-04-13 00:55:07 -05:00
## Next steps
Refer to the [Getting Started]({{< relref "../../getting-started/build-first-dashboard/" >}}) guide for information about logging in, setting up data sources, and so on.
2015-04-13 00:55:07 -05:00
## Configure Grafana
Refer to the [Configuration]({{< relref "../configure-grafana/" >}}) page for details on options for customizing your environment, logging, database, and so on.