How to Install Grafana on Debian 13 from the Official APT Repository
Add Grafana's APT repository on Debian 13, install and start the server, sign in on port 3000 and secure the default admin account.
Grafana is an open-source dashboard and visualization server. It does not store metrics itself; it connects to data sources such as Prometheus, InfluxDB, Loki, Graphite or SQL databases and turns their data into graphs, tables and alerts. At the end of this guide you will have Grafana running as a systemd service on Debian 13, installed from Grafana's own APT repository so that it updates with the rest of the system.
The steps are identical on Debian 12. Debian 8 (Jessie) is long out of support, and the old method of downloading a single versioned .deb file leaves you with a server that never receives updates, so use the repository on a current release instead.
Requirements
- A server running Debian 13 (or Debian 12).
- A user with
sudorights. - TCP port 3000 reachable from your workstation, or a reverse proxy in front of Grafana.
Step 1: Add the Grafana APT repository
Install the tools needed to fetch and verify the repository key:
sudo apt-get update
sudo apt-get install -y apt-transport-https wget gnupgDownload Grafana's signing key into the APT keyring directory:
sudo mkdir -p /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/grafana.asc https://apt.grafana.com/gpg-full.key
sudo chmod 644 /etc/apt/keyrings/grafana.ascAdd the repository for stable releases. The signed-by option limits the key to this repository only:
echo "deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.listStep 2: Install Grafana
Refresh the package index and install the open-source edition:
sudo apt-get update
sudo apt-get install -y grafanaThe repository carries two editions. grafana is Grafana OSS. grafana-enterprise is the edition Grafana Labs recommends by default; it is free to use, contains everything in OSS and can unlock paid features later with a licence. Install one or the other, not both:
sudo apt-get install -y grafana-enterpriseStep 3: Start the service
The package installs a systemd unit named grafana-server but does not start it. Start it and check its state:
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-serverEnable it so that it starts at boot:
sudo systemctl enable grafana-server.serviceStep 4: Sign in and change the admin password
Grafana listens on port 3000. Open http://203.0.113.10:3000 in a browser, replacing the address with your server's IP, and sign in with the username admin and the password admin. Grafana immediately asks you to set a new password. Do it now: the default credentials are public knowledge, and anything listening on a public address is found by scanners within hours.
If you run a firewall, allow the port, preferably only from the addresses that need it. With ufw, for example:
sudo ufw allow from 198.51.100.25 to any port 3000 proto tcpStep 5: Basic configuration
On a package installation all settings live in /etc/grafana/grafana.ini. Lines starting with a semicolon are commented-out defaults. The options you are most likely to change are in the [server] section:
[server]
# Address to bind to; empty means all interfaces
http_addr = 127.0.0.1
# Port to listen on (default 3000)
http_port = 3000
# The full public URL users type into the browser
root_url = https://grafana.example.com/Binding to 127.0.0.1 as shown is the right choice when a reverse proxy such as Nginx or Caddy terminates TLS in front of Grafana; set root_url to the public address so that links in alerts and OAuth redirects are correct. Restart Grafana after every change:
sudo systemctl restart grafana-serverGrafana runs as an unprivileged user, so it cannot bind to ports below 1024 on its own. If you want it on port 80 or 443 without a proxy, Grafana's documentation describes a systemd override that grants the CAP_NET_BIND_SERVICE capability; a reverse proxy is usually the simpler route.
From here, add your first data source under Connections in the web interface and build or import a dashboard.
Updates and removal
Because Grafana comes from an APT repository, it is upgraded together with the rest of the system:
sudo apt-get update
sudo apt-get upgradeRead the release notes before a major-version upgrade and back up /etc/grafana/grafana.ini and the data directory /var/lib/grafana (which holds the default SQLite database with your dashboards and users) first.
To remove Grafana, stop the service, remove the package and, if you no longer want the repository, delete its list file:
sudo systemctl stop grafana-server
sudo apt-get remove grafana
sudo rm -i /etc/apt/sources.list.d/grafana.listTroubleshooting
- The page does not load. Check
sudo systemctl status grafana-serverand the journal withsudo journalctl -u grafana-server -e. Then confirm the listener withsudo ss -ltnp | grep 3000and review your firewall and your provider's network filter. - You forgot the admin password. Reset it from the shell:
sudo grafana cli admin reset-admin-password NEW_PASSWORD. If the command cannot find its defaults, add--homepath "/usr/share/grafana"directly aftergrafana cli.
The full installation reference is in the Grafana documentation for Debian and Ubuntu.
Frequently asked questions
Should I install Grafana OSS or Grafana Enterprise?
Both are free to run. OSS is the purely open-source build. Enterprise contains the same features plus code that only becomes active with a paid licence, which makes a later upgrade to a licensed setup possible without reinstalling. If you want only open-source software on the machine, choose grafana.
Does Grafana need a separate database?
Not for a single server. Out of the box Grafana stores users, dashboards and settings in an embedded SQLite database inside its data directory. MySQL or PostgreSQL only become necessary for larger or highly available installations.
Can I install a single .deb file instead of adding the repository?
Yes, the Grafana download page offers .deb packages for each version. The drawback is that you must download and install every new version by hand, so the repository is the better choice for a server you intend to keep.
Is it safe to expose port 3000 to the internet?
Plain HTTP on port 3000 sends your password and session cookie unencrypted. For anything beyond a quick test, put Grafana behind a reverse proxy with a TLS certificate, or reach it through a VPN or an SSH tunnel.