How to Install Grafana

October 9, 2023

Method 1: Using APT

Install Grafana on Ubuntu/Debian using APT package manager:

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://apt.grafana.com/gpg.key

Add Grafana repository and install:

echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana

Start Grafana service:

sudo systemctl start grafana-server

Method 2: Using Docker

Create a docker-compose.yml file:

version: '3'

services:
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    ports:
      - "3000:3000"
    volumes:
      - grafana_data:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_USER=admin
      - GF_SECURITY_ADMIN_PASSWORD=adminpassword
    networks:
      - monitoring

volumes:
  grafana_data:

networks:
  monitoring:

Configuration Details

  • Port: 3000 (default web interface)
  • Default Credentials: admin/adminpassword
  • Data Persistence: Using named volume
  • Network: Custom bridge network for monitoring

Post-Installation Steps

  1. Access Grafana at http://localhost:3000
  2. Log in with default credentials
  3. Change default password
  4. Configure data sources
  5. Import or create dashboards
#Grafana #Monitoring #Docker #Ubuntu #Installation