2016-10-21 04:01:34 -05:00
+++
2019-12-05 12:51:08 -06:00
title = "Install on Debian/Ubuntu"
description = "Install guide for Grafana on Debian or Ubuntu"
2016-10-21 04:01:34 -05:00
keywords = ["grafana", "installation", "documentation"]
type = "docs"
2019-12-30 01:17:03 -06:00
aliases = ["/docs/grafana/latest/installation/installation/debian"]
2016-10-21 04:01:34 -05:00
[menu.docs]
2019-12-05 12:51:08 -06:00
name = "Install on Ubuntu/Debian"
2016-10-21 04:01:34 -05:00
identifier = "debian"
parent = "installation"
2019-11-13 06:04:06 -06:00
weight = 200
2016-10-21 04:01:34 -05:00
+++
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
# Install on Debian or Ubuntu
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
This page explains how to install Grafana dependencies, download and install Grafana, get the service up and running on your system, and the package details.
2017-04-28 03:58:26 -05:00
2019-12-30 10:04:02 -06: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 "upgrading.md" >}} ) for tips and guidance on updating an existing installation.
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
## 1. Download and install
2017-09-14 04:28:59 -05:00
2019-12-05 12:51:08 -06:00
We recommend that you run all the listed commands before you download and install Grafana. They might not be necessary on all systems, but if you run them first then you will not be interrupted by dependency errors.
You can install Grafana using our official APT repository, by downloading a `.deb` package, or by using a binary `.tar.gz` file.
2018-02-05 09:02:17 -06:00
2019-12-06 05:04:29 -06:00
On some older versions of Ubuntu and Debian you may need to install the `apt-transport-https` package which is needed to fetch packages over HTTPS.
2018-04-20 06:23:45 -05:00
2019-12-05 12:51:08 -06:00
```bash
sudo apt-get install -y apt-transport-https
```
2015-08-12 09:30:48 -05:00
2019-12-05 12:51:08 -06:00
Install any missing dependencies:
2019-11-13 06:04:06 -06:00
2019-06-13 02:52:44 -05:00
```bash
2019-12-05 12:51:08 -06:00
sudo apt-get install -y software-properties-common wget
2019-06-13 02:52:44 -05:00
```
2019-12-19 08:48:16 -06:00
Add our GPG key to install signed packages:
2015-04-14 09:28:57 -05:00
2017-10-05 12:01:03 -05:00
```bash
2019-12-19 08:48:16 -06:00
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
2017-10-05 12:01:03 -05:00
```
2015-04-20 05:33:32 -05:00
2019-12-19 08:48:16 -06:00
Add this repository for stable releases:
2019-01-08 09:45:04 -06:00
```bash
2019-12-19 08:48:16 -06:00
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
2019-01-08 09:45:04 -06:00
```
2019-12-19 08:48:16 -06:00
Add this repository if you want beta releases:
2015-04-14 09:28:57 -05:00
2017-10-05 12:01:03 -05:00
```bash
2019-12-19 08:48:16 -06:00
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb beta main"
2017-05-08 01:02:08 -05:00
```
2015-04-14 09:28:57 -05:00
2019-12-05 12:51:08 -06:00
Update your APT repositories and install Grafana:
2015-04-14 09:28:57 -05:00
2017-05-08 01:02:08 -05:00
```bash
sudo apt-get update
sudo apt-get install grafana
```
2015-04-14 09:28:57 -05:00
2020-01-08 03:38:31 -06:00
### Set up repository for ARM
If you have problems using `add-apt-repository` , you can set up the repository without it.
Add this repository for stable releases:
```bash
echo "deb 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 https://packages.grafana.com/oss/deb beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
```
2019-12-05 12:51:08 -06:00
### Install .deb package
2015-04-14 09:28:57 -05:00
2019-12-06 05:04:29 -06:00
Go to the [Linux download page ](https://grafana.com/grafana/download?platform=linux ) for the latest download links.
2015-04-14 09:28:57 -05:00
2019-12-06 05:04:29 -06:00
If you use ARM, then use the [ARM download page ](https://grafana.com/grafana/download?platform=arm ) for the latest download links.
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
```bash
sudo wget < .deb package url >
sudo apt-get install -y adduser libfontconfig1
sudo dpkg -i grafana_< version > _amd64.deb
```
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
## Install from binary .tar.gz file
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06: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 that you downloaded. This folder contains all files required to run Grafana. There are no init scripts or install scripts in this package.
2015-04-13 00:34:55 -05:00
2017-05-08 01:02:08 -05:00
```bash
2019-12-05 12:51:08 -06:00
sudo wget < tar.gz package url >
sudo apt-get install -y adduser libfontconfig1
sudo tar -zxvf < tar.gz package >
2017-05-08 01:02:08 -05:00
```
2015-05-10 15:15:34 -05:00
2019-12-05 12:51:08 -06:00
## 2. Start the server
This starts the `grafana-server` process as the `grafana` user, which was created during the package installation.
2015-05-10 15:15:34 -05:00
2019-12-05 12:51:08 -06:00
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.
2018-07-11 10:13:15 -05:00
2019-12-05 12:51:08 -06:00
### Start the server with systemd
To start the service using systemd:
2015-04-13 01:14:13 -05:00
2017-05-08 01:02:08 -05:00
```bash
2019-12-05 12:51:08 -06:00
sudo systemctl daemon-reload
sudo systemctl start grafana-server
2017-05-08 01:02:08 -05:00
```
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
Verify that the service has started:
2015-05-10 15:15:34 -05:00
2017-05-08 01:02:08 -05:00
```bash
2019-12-05 12:51:08 -06:00
sudo systemctl status grafana-server
2017-05-08 01:02:08 -05:00
```
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
Enable the systemd service so that Grafana starts at boot:
2015-04-13 01:14:13 -05:00
2017-05-08 01:02:08 -05:00
```bash
sudo systemctl enable grafana-server.service
```
2015-04-13 01:14:13 -05:00
2019-12-05 12:51:08 -06:00
### Start the server with init.d
Start Grafana by running:
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
```bash
sudo service grafana-server start
```
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
Verify that the service has started:
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
```bash
sudo service grafana-server status
```
2015-04-13 01:14:13 -05:00
2019-12-05 12:51:08 -06:00
Configure the Grafana server to start at boot:
2015-04-13 01:14:13 -05:00
2019-12-05 12:51:08 -06:00
```bash
sudo update-rc.d grafana-server defaults
```
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
### Execute the binary
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
The `grafana-server` binary needs the working directory to be the root install directory where the binary and the `public` folder are located.
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
Start Grafana by running:
```bash
./bin/grafana-server web
```
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
## Package details
2015-04-13 00:34:55 -05:00
2019-12-05 12:51:08 -06:00
- 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 an 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
2019-12-05 12:51:08 -06:00
## Next steps
2015-05-10 15:15:34 -05:00
2020-01-06 09:43:01 -06:00
Refer to the [Getting Started ]({{< relref "../guides/getting_started/" >}} ) guide for information about logging in, setting up data sources, and so on.
2015-04-13 00:55:07 -05:00
2019-12-05 12:51:08 -06:00
## Configure Grafana
2018-08-14 06:21:52 -05:00
2019-12-05 12:51:08 -06:00
Refer the [Configuration ]({{< relref "configuration.md" >}} ) page for details on options for customizing your environment, logging, database, and so on.