Installing Grafana
Grafana is available in two editions: Grafana Enterprise (recommended) and Grafana Open Source. Grafana Enterprise is free and includes all OSS features, with the option to upgrade to the full Enterprise feature set. This guide covers multiple installation methods to help you get Grafana running quickly.Prerequisites
Before you begin, ensure you have:- A supported operating system (Linux, macOS, Windows, or Docker)
- Appropriate system permissions for installation
- Network access to download Grafana packages
Installation Methods
Docker
Run Grafana in a container with persistent storage
Debian/Ubuntu
Install using APT package manager
Standalone Binary
Run Grafana as a standalone application
Docker Compose
Deploy Grafana with docker-compose
Docker Installation
Docker is the fastest way to get Grafana running.Quick Start
Run the latest Grafana Enterprise version:http://localhost:3000 with default credentials admin/admin.
Docker Run Command Explanation
Docker Run Command Explanation
docker run- Creates and starts a new container-d- Runs container in detached mode (background)-p 3000:3000- Maps container port 3000 to host port 3000--name=grafana- Assigns a name to the container for easy referencegrafana/grafana-enterprise- The Docker image to use
Persistent Storage with Docker Volumes
By default, Grafana data is lost when the container is removed. Use Docker volumes to persist your data:Using Bind Mounts
For direct access to Grafana data on your host filesystem:Environment Variables
Configure Grafana using environment variables:Installing Plugins
Install plugins at container startup:To specify a plugin version, use the format:
plugin-name@version. Example: grafana-clock-panel@1.0.1Managing Docker Containers
Docker Compose Installation
Docker Compose simplifies multi-container deployments.Prerequisites
Verify Docker Compose is installed:Basic Configuration
Create adocker-compose.yaml file:
docker-compose.yaml
Start and Manage
Debian Ubuntu Installation
Install Grafana on Debian or Ubuntu using the APT package manager.Install from APT Repository
This method provides automatic updates when you runapt-get update.
Step 1: Install Prerequisites
Step 2: Add Grafana GPG Key
Step 3: Add Grafana Repository
For stable releases:Step 4: Update Package List
Step 5: Install Grafana
For Grafana Enterprise (recommended):Step 6: Start Grafana Service
http://localhost:3000 with default credentials admin/admin.
Install Using DEB Package
For manual installation without automatic updates:- Navigate to the Grafana download page
- Select your desired version and edition
- Copy and run the installation commands provided
Standalone Binary Installation
Run Grafana as a standalone binary without package managers.Step 1: Download Binary
Download the appropriate binary from the Grafana download page.Step 2: Create Grafana User
Step 3: Extract and Move Binary
Step 4: Create Systemd Service
Create/etc/systemd/system/grafana-server.service:
/etc/systemd/system/grafana-server.service
Step 5: Initialize Data Directory
Start Grafana manually once to create the data directory:CTRL+C to stop, then set ownership:
Step 6: Enable and Start Service
First Login
After installation:- Open your browser and navigate to
http://localhost:3000 - Login with default credentials:
- Username:
admin - Password:
admin
- Username:
- You’ll be prompted to change the password on first login
Configuration
Grafana configuration is stored ingrafana.ini. Common configuration locations:
- Docker: Use environment variables prefixed with
GF_ - APT install:
/etc/grafana/grafana.ini - Standalone:
/usr/local/grafana/conf/grafana.ini
Uninstalling Grafana
Docker
Debian/Ubuntu
Standalone Binary
Next Steps
Create Your First Dashboard
Learn how to build visualizations
Add Data Sources
Connect Grafana to your data
Troubleshooting
Port 3000 Already in Use
Port 3000 Already in Use
If port 3000 is already occupied, map to a different port:Access Grafana at
http://localhost:3001Permission Denied Errors
Permission Denied Errors
Ensure the Grafana user has proper permissions:
Service Won't Start
Service Won't Start
Check service logs: