English
Grafana DEB Package Installation Guide | Compatible with Ubuntu/Debian

Preface
As the most popular open-source data visualization platform, Grafana is widely used in the monitoring field. On Ubuntu/Debian systems, in addition to using the APT package manager,DEB package installation It is the most direct and controllable approach, especially suitable for the following scenarios:
Development and testing environment: Quickly verify Grafana functionality
Standalone monitoring: Only need to monitor a few physical machines or virtual machines and build a lightweight monitoring platform
Version lock: Need precise control over the Grafana version to avoid automatic APT upgrades
Offline environment: Intranet servers cannot access the APT repository
This article documents in detail in Ubuntu 22.04 Complete process for installing Grafana OSS open-source edition via DEB package on the system, from downloading, installation, configuration, and firewall opening to service management, covering all key steps and troubleshooting experience.
💡 Version selection tip:
Grafana provides OSS (Open Source Version) and Enterprise (Enterprise Edition) Two versions. This article uses the OSS open-source version for demonstration. It includes all core Grafana features such as visualization, alerting, and data sources, and fully meets the needs of personal development, testing, and most production scenarios. The Enterprise version additionally provides advanced features such as reporting, RBAC, and SAML, and is suitable for environments with enterprise-level requirements. The installation process is exactly the same for both; you can replace the download link according to your own needs.
Whether you are an operations engineer, developer, or Homelab enthusiast, you can quickly set up a usable Grafana monitoring platform through this article.
Environment Description
| Project | information |
|---|---|
| Operating system | Ubuntu 22.04 LTS+ / Debian 11+ |
| Architecture | x86_64 (amd64) |
| Grafana version | 13.2.0 |
| Installation method | DEB package |
| Service Management | systemd |
Part 1: Download the Grafana DEB package
1.1 Download from GitHub Releases
bash
# Enter the temporary directory
cd /tmp
# Download the Grafana OSS open-source DEB package
wget https://github.com/grafana/grafana/releases/download/v13.2.0/grafana_13.2.0_32077357341_linux_amd64.deb1.2 Installing from the APT repository (alternative)
If the network permits, you can install directly from the official Grafana APT repository:
bash
# Add the official Grafana APT repository
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 /etc/apt/sources.list.d/grafana.list
# Update and install
sudo apt-get update
sudo apt-get install grafana -y1.3 Version Selection Instructions
| Version type | Applicable scenarios | Explanation |
|---|---|---|
| OSS (Open Source Version) | Development testing, personal Homelab | Fully open source, with enough features for most scenarios, no license required. |
| Enterprise (Enterprise Edition) | Enterprise production environment | Includes advanced commercial features; a License must be applied for. |
Part 2: Installing the DEB Package
2.1 First installation
bash
# Install DEB packages using dpkg
sudo dpkg -i grafana_13.2.0_linux_amd64.debExpected output:
Selecting previously unselected package grafana.
(Reading database ... 123456 files and directories currently installed.)
Preparing to unpack grafana_13.2.0_linux_amd64.deb ...
Unpacking grafana (13.2.0) ...
Setting up grafana (13.2.0) ...
Created symlink /etc/systemd/system/multi-user.target.wants/grafana-server.service → /usr/lib/systemd/system/grafana-server.service.2.2 Handling Dependency Issues
If a dependency missing prompt appears during installation:
bash
# Fix dependencies
sudo apt-get install -f2.3 Upgrade Installation
If an older version of Grafana is already installed on the system:
bash
# Use dpkg -i to overwrite-install (will automatically upgrade)
sudo dpkg -i grafana_13.2.0_linux_amd64.deb2.4 Verify the Installation
bash
# View the list of installed files
dpkg -L grafana
# View version
/usr/sbin/grafana-server -v
# Output: Version 13.2.0 (commit: f681b1359f, branch: HEAD)
# View Grafana CLI version
/usr/sbin/grafana-cli -vPart 3: Configuring Grafana
3.1 Default Configuration File Location
| file | path | Explanation |
|---|---|---|
| Main configuration file | /etc/grafana/grafana.ini | Grafana Core Configuration |
| Systemd service | /usr/lib/systemd/system/grafana-server.service | Service Management |
| Data Catalog | /var/lib/grafana | Stored data (default) |
| Log directory | /var/log/grafana | log file |
| Plugin directory | /var/lib/grafana/plugins | Plugin storage location |
| Default configuration file | /usr/share/grafana/conf/defaults.ini | Default configuration reference |
3.2 Modify the configuration file
bash
# Back up the original configuration
sudo cp /etc/grafana/grafana.ini /etc/grafana/grafana.ini.bak
# Edit configuration
sudo vim /etc/grafana/grafana.iniKey configuration items:
ini
[server]
# Protocol (http, https, h2, socket, socket_h2)
protocol = http
# Minimum TLS version allowed. By default, this value is empty. Accepted values are: TLS1.2, TLS1.3. If nothing is set TLS1.2 would be taken
;min_tls_version = ""
# The ip address to bind to, empty will bind to all interfaces
http_addr =
# The http port to use
http_port = 3000
# The public facing domain name used to access grafana from a browser
domain = 192.168.0.2313.3 Modify data directory permissions
bash
# Installing the DEB package automatically creates the grafana user, ensuring correct directory permissions.
sudo chown -R grafana:grafana /var/lib/grafana
sudo chown -R grafana:grafana /var/log/grafanaPart Four: Start the Grafana Service
4.1 Managing with systemd
bash
# Reload systemd configuration
sudo systemctl daemon-reload
# Start service
sudo systemctl start grafana-server
# Set to start on boot
sudo systemctl enable grafana-server
# Check service status
sudo systemctl status grafana-server4.2 Verify that the service is running normally
bash
# Check port listening
sudo netstat -lntp | grep 3000
# Expected output:
# tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 12345/grafana-server
# or use the ss command
ss -lntp | grep 3000
# Test local access
curl http://192.168.0.231:3000 | head -20
# View service logs
sudo journalctl -u grafana-server -fPart Five: Open the Firewall
This is Easiest to overlook a step, and also the main reason why external access is unavailable.
5.1 Using ufw (Ubuntu default)
bash
# Check firewall status
sudo ufw status
# Open port 3000
sudo ufw allow 3000/tcp
# Reload firewall
sudo ufw reload
# validation rules
sudo ufw status | grep 30005.2 Using iptables
bash
# Add rule
sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
# Save rules (Ubuntu)
sudo apt-get install iptables-persistent -y
sudo netfilter-persistent save5.3 Disable the firewall (test environment only)
bash
# Temporarily closed
sudo ufw disable
# Permanently disable (not recommended for production environment)
sudo ufw disablePart Six: SELinux/AppArmor Configuration
6.1 Ubuntu Uses AppArmor
Ubuntu uses AppArmor by default instead of SELinux, and usually does not block Grafana. If you encounter permission issues:
bash
# Check AppArmor status
sudo aa-status
# View Grafana-related logs
sudo journalctl -u grafana-server | grep -i apparmor6.2 If AppArmor is blocking Grafana
bash
# Temporarily disable Grafana's AppArmor profile (not recommended)
sudo aa-disable /etc/apparmor.d/usr.sbin.grafana-server
# Restart the service
sudo systemctl restart grafana-serverPart 7: Accessing Grafana
7.1 Web Login
bash
# Browser access
http://<server IP>:3000
# Default credentials
Username: admin
Password: admin7.2 First Login
On first login,Force password change required It is recommended to set a strong password.
7.3 Validation API
bash
# Check Grafana health status
curl http://localhost:3000/api/health
# Expected return:
# {
# "database": "ok",
# "version": "13.2.0",
# "commit": "f681b1359f6a0b8ecb9f2c49a88ac72b75bde73b"
# }Part 8: Common Issues and Troubleshooting
Q1:dpkg -i reports missing dependencies
dpkg: dependency problems prevent configuration of grafana:
grafana depends on libc6 (>= 2.34); however:Solution:
bash
# Fix dependencies
sudo apt-get install -fQ2: Service startup failed; the port is already in use
bash
# Check port usage
sudo lsof -i:3000
sudo netstat -tlnp | grep 3000
# Kill the occupying process
sudo kill -9 <PID>
sudo systemctl start grafana-serverQ3: Cannot access externally (Connection refused)
检查顺序:
bash
# 1. Is the service running?
sudo systemctl status grafana-server
# 2. Whether the port is listening
sudo netstat -lntp | grep 3000
# 3. Is the firewall open?
sudo ufw status
# 4. Whether the configuration binds to 0.0.0.0
cat /etc/grafana/grafana.ini | grep http_addr
# 5. Cloud provider security groups (e.g., AWS, Alibaba Cloud)
# Port 3000 needs to be opened in the console.Q4: Forgot admin password
bash
# Reset the password to admin
sudo /usr/sbin/grafana-cli admin reset-admin-password admin
# Restart the service
sudo systemctl restart grafana-serverQ5: DEB package and APT version conflict
If both the APT-installed version and the manually installed DEB package exist:
bash
# View installed version
dpkg -l | grep grafana
# Completely uninstall
sudo dpkg -r grafana
sudo apt-get autoremove -y
# Reinstall the DEB package
sudo dpkg -i grafana_13.2.0_linux_amd64.deb第九部分:常用管理命令速查
| Operation | Command |
|---|---|
| Start service | sudo systemctl start grafana-server |
| Stop service | sudo systemctl stop grafana-server |
| Restart the service | sudo systemctl restart grafana-server |
| View status | sudo systemctl status grafana-server |
| Set to start on boot | sudo systemctl enable grafana-server |
| View logs | sudo journalctl -u grafana-server -f |
| View version | /usr/sbin/grafana-server -v |
| Reset password | sudo /usr/sbin/grafana-cli admin reset-admin-password <新密码> |
| Install plugin | sudo /usr/sbin/grafana-cli plugins install <插件名> |
| View configuration | cat /etc/grafana/grafana.ini |
Part Ten: Upgrade Guide
10.1 View the current version
bash
/usr/sbin/grafana-server -v10.2 Download the New Version
bash
wget https://github.com/grafana/grafana/releases/download/v13.2.0/grafana_13.2.0_linux_amd64.deb10.3 Execute Upgrade
bash
# Stop service
sudo systemctl stop grafana-server
# Back up configuration and data
sudo cp -r /etc/grafana /etc/grafana.bak
sudo cp -r /var/lib/grafana /var/lib/grafana.bak
# Upgrade installation
sudo dpkg -i grafana_13.2.0_linux_amd64.deb
# Start service
sudo systemctl start grafana-server
# Verification version
/usr/sbin/grafana-server -vPart 11: DEB vs RPM vs Docker Comparison
| Comparison item | DEB installation | RPM installation | Docker container |
|---|---|---|---|
| Applicable systems | Ubuntu/Debian | CentOS/RHEL | All Linux |
| Dependency management | ✅ APT Automatic Processing | ✅ YUM automatic processing | ✅ Included in the image |
| Service Management | ✅ systemd | ✅ systemd | ⚠️ Container Management |
| Installation speed | ⚡ Extremely fast | ⚡ Extremely fast | ⚡ Fast |
| Data persistence | ✅ Local directory | ✅ Local directory | ⚠️ Volume mount required |
| learning curve | low | low | middle |
| Applicable scenarios | Ubuntu/Debian production environment | CentOS/RHEL production environment | cloud-native environment |
Conclusion
Through this article, you have mastered the complete process of installing Grafana via DEB package on Ubuntu/Debian systems:
✅ Download and install the Grafana DEB package
✅ Configure Grafana (bound to
0.0.0.0, allow external access)✅ Manage services with systemd
✅ Open firewall (ufw) configuration
✅ Access the Grafana web interface
✅ Common troubleshooting
✅ Version upgrade process
The core advantages of the DEB installation method: Simple, fast, and controllable—the best choice for single-machine and traditional O&M scenarios on Ubuntu/Debian systems.
Related resources:
All operations in this article have been verified in an Ubuntu 22.04 LTS environment and are applicable to Debian 11+ and compatible distributions.