How to install Grafana

Use APT

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
sudo apt-get update
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
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
sudo systemctl start grafana-server

Use Docker

docker-compose.yml

version: '3'

services:
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    ports:
      - "3000:3000"  # Map Grafana's web UI to port 3000 on your host
    volumes:
      - grafana_data:/var/lib/grafana  # Persist Grafana data
    environment:
      - GF_SECURITY_ADMIN_USER=admin  # Grafana admin user
      - GF_SECURITY_ADMIN_PASSWORD=adminpassword  # Grafana admin password
    networks:
      - monitoring

volumes:
  grafana_data:  # Define a named volume for Grafana data

networks:
  monitoring:  # Create a custom bridge network for Grafana and other monitoring tools

 













Leave a Reply

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