Installing Grafana
1. Installing via Package Manager
| Operating System | Package Manager | Command | Notes |
|---|---|---|---|
| Ubuntu/Debian | apt |
sudo apt-get install -y grafana |
Requires Grafana repository setup |
| CentOS/RHEL/Fedora | yum |
sudo yum install -y grafana |
Requires Grafana repository setup |
| Amazon Linux | yum |
sudo yum install -y grafana |
Requires Grafana repository setup |
| SUSE/openSUSE | zypper |
sudo zypper install grafana |
Requires Grafana repository setup |
Note: Ensure the Grafana repository is added before installing via package manager.
2. Installing via Docker
Example: Run Grafana with Docker
docker run -d --name=grafana -p 3000:3000 grafana/grafana-enterprise
| Option | Values | Notes |
|---|---|---|
| image | grafana/grafana-enterprise |
Latest stable Grafana Enterprise image |
| port mapping | 3000:3000 |
Maps host port 3000 to container port 3000 |
| volume mount | /var/lib/grafana |
Mounts local directory for persistent storage |
Note: By default, Grafana runs with user ID 472. Ensure the mounted directory has appropriate permissions for this UID.
Example: Run Grafana with persistent storage
docker run -d --name=grafana \\<br> -p 3000:3000 \\<br> -v /var/lib/grafana:/var/lib/grafana \\<br> grafana/grafana-enterprise
3. Installing via Kubernetes
Example: Deploy Grafana using Helm Chart
apiVersion: v1
kind: Namespace
metadata:
name: monitoring
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:latest
ports:
- containerPort: 3000
env:
- name: GF_SECURITY_ADMIN_PASSWORD
value: "admin123"
| Parameter | Description | Default Value |
|---|---|---|
| image | Container image to use for Grafana | grafana/grafana:latest |
| port | Port to expose Grafana on | 3000 |
| adminPassword | Password for admin user | admin123 |
Note: Ensure that the namespace
monitoring exists before deploying Grafana.
Warning: The default admin password should be changed in production environments.
4. Installing from Binary
Installing Grafana from a binary package is a straightforward process that involves downloading the appropriate binary for your operating system and running it directly.
| Platform | Download URL | Installation Steps |
|---|---|---|
| Linux (x64) | Download | 1. Extract the archive: tar -zxvf grafana-11.3.0.linux-amd64.tar.gz2. Navigate to the directory: cd grafana-11.3.03. Start Grafana: ./bin/grafana-server |
| macOS (x64) | Download | 1. Extract the archive: tar -zxvf grafana-11.3.0.darwin-amd64.tar.gz2. Navigate to the directory: cd grafana-11.3.03. Start Grafana: ./bin/grafana-server |
| Windows (x64) | Download | 1. Extract the archive using a tool like 7-Zip or WinZip 2. Navigate to the directory: cd grafana-11.3.03. Start Grafana: ./grafana-server.exe |
Example: Starting Grafana Server
# Start Grafana in the background
./bin/grafana-server &lt;span class="hljs-comment"># On Linux/macOS</span>
# Start Grafana in the foreground (useful for debugging)
./bin/grafana-server --homepath=/path/to/grafana
Note: By default, Grafana starts on port
3000. You can change this in the configuration file (conf/defaults.ini).
Warning: Ensure that the binary has execute permissions on Linux/macOS systems before running it.
5. Installing on Windows
Install Grafana on Windows using the official installer or by downloading a ZIP package.
| Installation Method | Description | Notes |
|---|---|---|
| Windows Installer | Download the .msi installer from the Grafana website. |
Installs Grafana as a Windows service and sets up the default configuration. |
| ZIP Package | Download the grafana-<version>-windows-<arch>.zip package. |
Extract and run manually. No service installation or auto-start. |
Example: Installing via Windows Installer
grafana-server.exe --config=C:\grafana\conf\defaults.ini --homepath=C:\grafana
Note: The Windows installer sets up Grafana to run as a service by default. You can change this behavior in the configuration file.
Warning: Ensure that port
3000 is not blocked by a firewall or another application.
Installation Steps
- Download the Grafana installer for Windows from grafana.com.
- Run the installer as an administrator.
- Follow the setup wizard to configure the service and default settings.
- Start Grafana via the Windows Services panel or command line.
6. Verifying Installation
| Check | Description | Command |
|---|---|---|
| Service status | Verify Grafana service is running | systemctl status grafana-server |
| Port binding | Ensure Grafana is listening on default port 3000 | netstat -tuln | grep 3000 |
| Configuration file | Check main config file for errors | grafana-cli config-test |
Note: On systems with systemd, use
systemctl to manage service status. For systems without systemd, check the process directly using ps aux | grep grafana.7. Understanding Grafana Editions
| Edition | Features | License | Support |
|---|---|---|---|
| Grafana Open Source | Core dashboarding, alerting, data visualization, and plugin ecosystem | Apache 2.0 | Community support via forums and documentation |
| Grafana Enterprise | All Open Source features + advanced security, SSO, audit logs, and enterprise plugins | Proprietary (requires license) | Official support via Grafana Labs |
| Grafana Cloud | Managed Grafana instance with built-in data sources, alerting, and analytics | Subscription-based (varies by plan) | Official support via Grafana Labs |
Note: Grafana Open Source is free and open-source, while Enterprise and Cloud editions provide additional enterprise-grade capabilities.
8. Upgrading Grafana Versions
| Version | Upgrade Method | Notes |
|---|---|---|
| Grafana 10.x | apt upgrade grafana (Debian/Ubuntu) or yum update grafana (RHEL/CentOS) |
Ensure repository is configured correctly before upgrading |
| Grafana 10.x | brew upgrade grafana (macOS) |
Use Homebrew to manage Grafana on macOS systems |
| Grafana 10.x | Manual download and installation | Download from grafana.com and follow installation instructions |
Example: Upgrading via Package Manager
# Update package list
sudo apt update
# Upgrade Grafana
sudo apt upgrade grafana
Note: Back up your Grafana database and configuration files before performing any upgrade to prevent data loss.
Warning: Grafana does not support downgrading versions. Always ensure compatibility with plugins and dashboards before upgrading.
9. Installing Grafana Agent
The Grafana Agent is a lightweight, open-source agent for collecting and sending metrics, logs, and traces to Grafana.
Example: Installing Grafana Agent on Linux
curl -fsSL https://raw.githubusercontent.com/grafana/agent/main/scripts/install.sh | sudo sh
| Installation Method | Description | Notes |
|---|---|---|
| Package Manager | apt, yum, brew |
Available for Debian, Ubuntu, CentOS, RedHat, and macOS |
| Binary Download | Precompiled binaries for various platforms | Can be downloaded from the releases page |
| Docker | Official Docker image available | grafana/agent |
Note: The Grafana Agent supports various data sources and can be configured via a YAML file.
10. Setting Up Grafana Cloud
Example: Grafana Cloud Setup
curl -s https://raw.githubusercontent.com/grafana/cloud-quickstart/main/install.sh | bash
| Step | Description | Action |
|---|---|---|
| 1 | Sign up for Grafana Cloud | Visit grafana.com and create an account |
| 2 | Set up a Grafana instance | Use the Grafana Cloud quickstart or dashboard to create an instance |
| 3 | Configure data sources | Add Prometheus, Loki, or other data sources to your instance |
| 4 | Create dashboards | Build and customize dashboards using the Grafana UI or API |
Note: Grafana Cloud offers a free tier with limited features. Upgrade for more advanced capabilities and higher data limits.