2016-10-21 04:01:34 -05:00
+++
title = "Installing on Debian / Ubuntu"
description = "Install guide for Grafana"
keywords = ["grafana", "installation", "documentation"]
type = "docs"
2016-12-16 10:36:01 -06:00
aliases = ["/installation/installation/debian"]
2016-10-21 04:01:34 -05:00
[menu.docs]
name = "Installing on Ubuntu / Debian"
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
# Installing on Debian / Ubuntu
2019-12-05 06:09:57 -06:00
Read [Upgrading Grafana ]({{< relref "upgrading.md" >}} ) for tips and guidance on updating an existing
2017-04-28 03:58:26 -05:00
installation.
2019-07-12 11:12:50 -05:00
## Download
2015-04-13 00:34:55 -05:00
2019-07-12 11:12:50 -05:00
Go to the [download page ](https://grafana.com/grafana/download?platform=linux ) for the latest download
links.
2017-09-14 04:28:59 -05:00
2017-05-08 01:02:08 -05:00
```bash
2018-06-25 10:22:31 -05:00
wget < debian package url >
2019-04-15 01:20:42 -05:00
sudo apt-get install -y adduser libfontconfig1
2018-10-22 11:31:31 -05:00
sudo dpkg -i grafana_< version > _amd64.deb
2018-02-05 09:02:17 -06:00
```
2019-11-13 06:04:06 -06:00
You will find package URLs on the [download page ](https://grafana.com/grafana/download?platform=linux ).
2018-04-20 06:23:45 -05:00
2015-04-14 09:28:57 -05:00
## APT Repository
2015-08-12 09:30:48 -05:00
2019-11-13 06:04:06 -06:00
The command `add-apt-repository` isn't a default app on Debian 9 and requires you to run:
2019-06-13 02:52:44 -05:00
```bash
apt-get install -y software-properties-common
```
2019-11-13 06:04:06 -06:00
Install the repository for stable releases:
2015-04-14 09:28:57 -05:00
2017-10-05 12:01:03 -05:00
```bash
2019-04-02 00:02:58 -05:00
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
2017-10-05 12:01:03 -05:00
```
2015-04-20 05:33:32 -05:00
2019-11-13 06:04:06 -06:00
There is a separate repository if you want beta releases:
2019-01-08 09:45:04 -06:00
```bash
2019-04-02 00:02:58 -05:00
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb beta main"
2019-01-08 09:45:04 -06:00
```
2019-11-13 06:04:06 -06:00
Use the above line even if you are on Ubuntu or another Debian version. Then add our GPG key. This allows you to install signed packages.
2015-04-14 09:28:57 -05:00
2017-10-05 12:01:03 -05:00
```bash
2019-07-20 05:57:18 -05:00
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
2017-05-08 01:02:08 -05:00
```
2015-04-14 09:28:57 -05:00
2019-11-13 06:04:06 -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
2015-05-10 15:15:34 -05: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.
2015-04-14 09:28:57 -05:00
2017-05-08 01:02:08 -05:00
```bash
sudo apt-get install -y apt-transport-https
```
2015-04-14 09:28:57 -05:00
2015-04-13 00:34:55 -05:00
## Package details
- Installs binary to `/usr/sbin/grafana-server`
2015-05-10 15:52:40 -05:00
- 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`
2015-05-10 15:15:34 -05:00
- 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`
2017-06-26 10:42:50 -05:00
- Installs HTML/JS/CSS and other Grafana files at `/usr/share/grafana`
2015-04-13 00:34:55 -05:00
## Start the server (init.d service)
2015-08-11 13:58:30 -05:00
Start Grafana by running:
2015-04-13 00:34:55 -05:00
2017-05-08 01:02:08 -05:00
```bash
sudo service grafana-server start
```
2015-05-10 15:15:34 -05:00
This will start the `grafana-server` process as the `grafana` user,
which was created during the package installation. The default HTTP port
is `3000` and default user and group is `admin` .
2018-07-11 10:13:15 -05:00
Default login and password `admin` / `admin`
2015-05-10 15:15:34 -05:00
To configure the Grafana server to start at boot time:
2015-04-13 01:14:13 -05:00
2017-05-08 01:02:08 -05:00
```bash
sudo update-rc.d grafana-server defaults
```
2015-04-13 00:34:55 -05:00
2015-04-13 01:14:13 -05:00
## Start the server (via systemd)
2015-05-10 15:15:34 -05:00
2015-08-11 13:58:30 -05:00
To start the service using systemd:
2015-05-10 15:15:34 -05:00
2017-05-08 01:02:08 -05:00
```bash
systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server
```
2015-04-13 00:34:55 -05:00
2015-05-10 15:15:34 -05: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
2015-04-13 00:34:55 -05:00
## Environment file
2015-05-10 15:15:34 -05:00
The systemd service file and init.d script both use the file located at
`/etc/default/grafana-server` for environment variables used when
starting the back-end. Here you can override log directory, data
directory and other variables.
2015-04-13 00:34:55 -05:00
### Logging
2015-05-10 15:15:34 -05:00
By default Grafana will log to `/var/log/grafana`
2015-04-13 01:14:13 -05:00
### Database
2015-05-10 15:52:40 -05:00
The default configuration specifies a sqlite3 database located at
`/var/lib/grafana/grafana.db` . Please backup this database before
2016-10-21 04:01:34 -05:00
upgrades. You can also use MySQL or Postgres as the Grafana database, as detailed on [the configuration page ]({{< relref "configuration.md#database" >}} ).
2015-04-13 00:34:55 -05:00
## Configuration
2015-05-10 15:52:40 -05:00
The configuration file is located at `/etc/grafana/grafana.ini` . Go the
2016-10-21 04:01:34 -05:00
[Configuration ]({{< relref "configuration.md" >}} ) page for details on all
2015-05-10 15:52:40 -05:00
those options.
2015-04-13 00:34:55 -05:00
### Adding data sources
2019-06-12 01:01:44 -05:00
- [Graphite ]({{< relref "../features/datasources/graphite.md" >}} )
- [InfluxDB ]({{< relref "../features/datasources/influxdb.md" >}} )
- [OpenTSDB ]({{< relref "../features/datasources/opentsdb.md" >}} )
- [Prometheus ]({{< relref "../features/datasources/prometheus.md" >}} )
2015-04-13 00:34:55 -05:00
2015-04-13 00:55:07 -05:00
## Installing from binary tar file
2017-03-21 09:37:55 -05:00
Download [the latest `.tar.gz` file ](https://grafana.com/get ) and
2015-08-12 09:30:48 -05:00
extract it. This will extract into a folder named after the version you
downloaded. This folder contains all files required to run Grafana. There are
2015-08-11 13:58:30 -05:00
no init scripts or install scripts in this package.
2015-05-10 15:15:34 -05:00
2015-05-10 15:52:40 -05:00
To configure Grafana add a configuration file named `custom.ini` to the
`conf` folder and override any of the settings defined in
`conf/defaults.ini` .
2015-04-13 00:55:07 -05:00
2016-02-23 18:06:56 -06:00
Start Grafana by executing `./bin/grafana-server web` . The `grafana-server`
binary needs the working directory to be the root install directory (where the
binary and the `public` folder is located).
2018-08-14 06:21:52 -05:00
## Logging in for the first time
2019-12-05 06:09:57 -06:00
To run Grafana open your browser and go to http://localhost:3000/. 3000 is the default HTTP port that Grafana listens to if you haven't [configured a different port ]({{< relref "configuration/#http-port" >}} ).
Then follow the instructions [here ]({{< relref "../guides/getting_started/" >}} ).