Grafana Installation

Grafana runs on Linux, Windows, and macOS. It also runs inside Docker containers. This topic walks through the most common installation methods so you can pick the one that matches your environment.

System Requirements

Grafana is lightweight. A machine with 1 CPU core, 512 MB of RAM, and 1 GB of disk space is enough to run it comfortably for small teams. Production environments with heavy dashboards benefit from at least 2 CPU cores and 2 GB of RAM.

Installation on Ubuntu / Debian (Linux)

Ubuntu and Debian are the most popular Linux distributions for running Grafana. The steps below install Grafana OSS from the official Grafana repository.

Step 1 – Add the Grafana Repository

sudo apt-get install -y apt-transport-https software-properties-common wget
wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" \
  | sudo tee /etc/apt/sources.list.d/grafana.list

Step 2 – Install Grafana

sudo apt-get update
sudo apt-get install -y grafana

Step 3 – Start and Enable the Service

sudo systemctl start grafana-server
sudo systemctl enable grafana-server

After this, Grafana runs automatically every time the machine restarts.

Installation on CentOS / Red Hat (Linux)

Step 1 – Add the Repository File

sudo tee /etc/yum.repos.d/grafana.repo <<EOF
[grafana]
name=grafana
baseurl=https://rpm.grafana.com
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://rpm.grafana.com/gpg.key
sslverify=1
EOF

Step 2 – Install Grafana

sudo yum install grafana -y
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Installation with Docker

Docker is the fastest way to run Grafana without changing anything on your host machine. One command starts a fully working Grafana instance.

docker run -d \
  --name grafana \
  -p 3000:3000 \
  grafana/grafana

Here is what each flag means:

  • -d – Run in the background (detached mode)
  • --name grafana – Give the container a readable name
  • -p 3000:3000 – Map port 3000 inside the container to port 3000 on your machine

Persist Data with a Volume

By default, data inside a Docker container disappears when the container stops. Add a volume to keep your dashboards and settings safe.

docker run -d \
  --name grafana \
  -p 3000:3000 \
  -v grafana-storage:/var/lib/grafana \
  grafana/grafana

Installation on Windows

Download the Windows installer from the official Grafana website (grafana.com/grafana/download). Run the .msi file and follow the on-screen wizard. Grafana installs as a Windows service and starts automatically.

Installation on macOS

Homebrew is the easiest method on macOS.

brew install grafana
brew services start grafana

Accessing Grafana After Installation

Open any web browser and go to this address:

http://localhost:3000

The default login credentials are:

  • Username: admin
  • Password: admin

Grafana asks you to change the password on your first login. Always set a strong password before exposing Grafana to a network.

Installation Overview Diagram

Choose your environment
         │
  ┌──────┴──────┐──────────────┐──────────┐
  ▼             ▼              ▼          ▼
Linux         Docker         Windows    macOS
(apt/yum)   (docker run)   (.msi)    (brew)
  │             │              │          │
  └──────┬──────┘──────────────┘──────────┘
         ▼
  Open http://localhost:3000
         │
         ▼
  Log in (admin / admin)
         │
         ▼
  Change Password
         │
         ▼
  Grafana is Ready!

Verifying the Installation

Run this command on Linux to check that the Grafana service is active:

sudo systemctl status grafana-server

You should see "active (running)" in green text. If Grafana does not start, check the logs:

sudo journalctl -u grafana-server -f

The most common reason Grafana fails to start is port 3000 already being used by another application. Change the port in the configuration file at /etc/grafana/grafana.ini by editing the http_port value under the [server] section.

Leave a Comment

Your email address will not be published. Required fields are marked *