Self-Host Grafana and Prometheus on a VPS
Set up Prometheus 3.13 LTS, the node exporter and Grafana from its apt repository on Ubuntu 24.04, behind Caddy, with backups and updates.
Prometheus collects and stores time-series metrics, the node exporter publishes a server's CPU, memory, disk and network figures for it, and Grafana turns them into dashboards and alerts. This guide installs all three by hand on Ubuntu 24.04: Prometheus and the node exporter from the release archives on prometheus.io, Grafana from Grafana's apt repository, and Caddy in front of Grafana for HTTPS.
Prefer one click? Deploy Grafana + Prometheus from the VeloxaHost marketplace and skip the manual steps; this guide is for when you want to run every command yourself.
What you need
- A VeloxaHost server with the Ubuntu 24.04 LTS image. You get root, over SSH or in the browser terminal on the server's page.
- For HTTPS on a domain: a subdomain such as
grafana.example.comand a dedicated IPv4 address. Caddy gets its certificate over ports 80 and 443, which the shared IPv4 address does not offer; it only gives you a block of forwarded ports. A dedicated IPv4 is a paid add-on (the console shows the current price): choose it as "Network access" on the create page, or take one from the IP addresses page and attach it. Without one, use the SSH tunnel at the end of the install steps.
Neither project's install docs set a minimum. Prometheus memory and disk grow with the number of time series and how long you keep them, 15 days by default. A Veloxa 2 (2 vCPU, 4 GB RAM, 80 GB disk) at $15 a month, billed at $0.03 an hour and capped at the monthly price, runs the stack for a handful of servers.
Install Grafana and Prometheus
Create a user and directories for Prometheus (our commands).
sudo useradd --no-create-home --shell /bin/false prometheus sudo mkdir -p /etc/prometheus /var/lib/prometheusDownload Prometheus 3.13.4, the current long-term support (LTS) release on the download page when this was checked, and copy the binaries into place. Compare
sha256sumwith the checksum on the download page.wget https://github.com/prometheus/prometheus/releases/download/v3.13.4/prometheus-3.13.4.linux-amd64.tar.gz sha256sum prometheus-3.13.4.linux-amd64.tar.gz tar xvfz prometheus-3.13.4.linux-amd64.tar.gz sudo cp prometheus-3.13.4.linux-amd64/prometheus prometheus-3.13.4.linux-amd64/promtool /usr/local/bin/Download node exporter 1.12.1 the same way, as in the node exporter guide.
wget https://github.com/prometheus/node_exporter/releases/download/v1.12.1/node_exporter-1.12.1.linux-amd64.tar.gz tar xvfz node_exporter-1.12.1.linux-amd64.tar.gz sudo cp node_exporter-1.12.1.linux-amd64/node_exporter /usr/local/bin/Write
/etc/prometheus/prometheus.yml. It joins the two scrape jobs from Prometheus's first-steps and node exporter guides: Prometheus itself on 9090 and the node exporter on 9100.global: scrape_interval: 15s scrape_configs: - job_name: prometheus static_configs: - targets: ['localhost:9090'] - job_name: node static_configs: - targets: ['localhost:9100']sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus promtool check config /etc/prometheus/prometheus.ymlRun both as systemd services. The release archives ship no unit files, so these two are ours. Both listen on
127.0.0.1only, because neither has a login by default.# /etc/systemd/system/prometheus.service [Unit] Description=Prometheus After=network-online.target [Service] User=prometheus ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --web.listen-address=127.0.0.1:9090 Restart=on-failure [Install] WantedBy=multi-user.target# /etc/systemd/system/node_exporter.service [Unit] Description=Prometheus node exporter After=network-online.target [Service] User=nobody ExecStart=/usr/local/bin/node_exporter --web.listen-address=127.0.0.1:9100 Restart=on-failure [Install] WantedBy=multi-user.targetsudo systemctl daemon-reload sudo systemctl enable --now prometheus node_exporter curl http://localhost:9100/metrics | grep "node_"Install Grafana OSS from Grafana's apt repository, as in Grafana's Debian and Ubuntu guide.
sudo apt-get install -y apt-transport-https wget gnupg 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.asc echo "deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list sudo apt-get update sudo apt-get install grafanaTell Grafana its public address and keep it on loopback. In
/etc/grafana/grafana.ini, under[server]:http_addr = 127.0.0.1 domain = grafana.example.com root_url = https://grafana.example.com/Then start it and enable it at boot:
sudo systemctl daemon-reload sudo systemctl start grafana-server sudo systemctl enable grafana-server.serviceAdd the dedicated IPv4 to the interface (check the name with
ip addr) and to the network configuration so it survives a reboot, and point an A record forgrafana.example.comat it. IPv6 is not available in US East yet, so skip the AAAA record.ip addr add 198.51.100.5/32 dev eth0Install Caddy from its apt repository, then replace
/etc/caddy/Caddyfilewith this (ours) and reload. Grafana Live uses WebSockets, which Caddy'sreverse_proxypasses on its own.sudo apt install --yes debian-keyring debian-archive-keyring apt-transport-https curl curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list sudo chmod o+r /usr/share/keyrings/caddy-stable-archive-keyring.gpg sudo chmod o+r /etc/apt/sources.list.d/caddy-stable.list sudo apt update sudo apt install caddygrafana.example.com { reverse_proxy localhost:3000 }sudo systemctl reload caddy
Without a dedicated IPv4. Skip steps 8 and 9, leave domain and root_url unset, and tunnel in through the first port of your block, which forwards to SSH. Then open http://localhost:3000.
ssh -p 20000 -L 3000:127.0.0.1:3000 root@203.0.113.10
First login
Open https://grafana.example.com and sign in with admin as both username and password. Grafana asks for a new password straight away; set a strong one.
Then connect Prometheus. Go to Connections, Data sources, Add data source, Prometheus, and set the Prometheus server URL to http://localhost:9090, as Grafana's docs give for a Prometheus on the same machine. Choose Save & test. To see the node exporter's figures, import a node exporter dashboard from grafana.com's dashboard library, or build your own panels from node_ metrics.
In Prometheus, Status, Target health shows both jobs as up. Reach it over the same tunnel with -L 9090:127.0.0.1:9090.
Secure it
Firewall. VeloxaHost firewalls are network-level and stateful. Until you attach one, all traffic is allowed (except outbound TCP 25). Go to Firewalls, New Firewall, Add Rule: allow TCP 80 and 443 from 0.0.0.0/0 and TCP 22 only from YOUR.IP/32. Attach it on the server's page.
Prometheus and the exporter. Prometheus's security model presumes that anyone who reaches its HTTP endpoint can read every time series in the database. Keeping both on 127.0.0.1, as the units above do, keeps them private.
Grafana settings. In grafana.ini, set cookie_secure = true under [security], since Grafana is behind HTTPS. allow_sign_up under [users] is false by default; leave it so. reporting_enabled under [analytics] sends anonymous usage counters; set it to false if you prefer. Restart with sudo systemctl restart grafana-server.
Email alerts. Outbound port 25 is blocked, so point [smtp] at your provider: enabled = true, host = smtp.example.com:465 (the docs note 465 for implicit TLS) or 587, plus user, password and from_address.
Back it up
Grafana's backup guide lists three things: the configuration file /etc/grafana/grafana.ini, plugin data in /var/lib/grafana/plugins, and the SQLite database /var/lib/grafana/grafana.db, copied with Grafana shut down. In one go (our commands):
sudo systemctl stop grafana-server
sudo tar czf /root/grafana-$(date +%F).tar.gz /etc/grafana/grafana.ini /var/lib/grafana
sudo systemctl start grafana-server
For Prometheus, the storage docs recommend snapshots for backups; a plain copy taken while it runs can miss the last few hours. If losing old metrics is acceptable, back up only /etc/prometheus. To keep history, stop Prometheus and archive /var/lib/prometheus the same way.
On VeloxaHost, snapshots are instant and free (5 on Starter, 30 on Pay as you go): server page, Snapshots, name, Create. Restoring overwrites the current state. Automatic snapshots run every hour, 6 hours, 12 hours, daily or weekly, kept for 1, 3, 7, 14 or 30 days. The Backups page creates, downloads and restores server backups (as a new server), on a schedule of every 6 hours, 12 hours, daily or weekly, keeping 1 to 10.
Update it
Grafana comes from its apt repository. Back up first, read the upgrade notes for the new version (13.2.4 when this was checked), then:
sudo apt-get update
sudo apt-get upgrade
Update plugins with sudo grafana cli plugins update-all and restart Grafana.
Prometheus and the node exporter update by hand (our steps): download the new archive from the download page, stop the service, copy the new binaries over the old ones and start it again. Staying within the 3.13.x LTS line avoids feature changes between updates.
Troubleshooting
Save & test fails with "connection refused". Prometheus is not running or not on 9090. Check systemctl status prometheus and journalctl -u prometheus; a YAML error shows up in promtool check config.
A target is down. Open Status, Target health in Prometheus. For the node exporter, check systemctl status node_exporter and that curl http://localhost:9100/metrics answers.
Grafana redirects to the wrong address or login loops. root_url does not match the address in your browser. Fix it in grafana.ini and restart.
You lost the admin password. Reset it with Grafana's CLI:
sudo grafana cli --homepath "/usr/share/grafana" admin reset-admin-password <new password>
FAQ
What licenses do Grafana and Prometheus use?
Grafana is licensed under the GNU AGPLv3. Prometheus and the node exporter are licensed under Apache 2.0. Running them unmodified for your own monitoring places no extra obligations on you.
How long does Prometheus keep data?
15 days by default. Change it with --storage.tsdb.retention.time in the ExecStart line, for example 30d, and restart. Longer retention needs more disk.
Can I monitor my other servers?
Yes. Run the node exporter on each server and add it as a target. Across the internet, protect the exporter with TLS and basic authentication, which Prometheus and most exporters support, and limit its port in the firewall.
Why not open Prometheus on a port of my block?
Prometheus has no login by default, so anyone who reaches the port can read every metric. Use an SSH tunnel to look at it, and Grafana for everyday viewing.
Which VeloxaHost size fits this stack?
A Veloxa 2 (2 vCPU, 4 GB RAM, 80 GB disk) at $15 a month, billed at $0.03 an hour and capped at the monthly price, runs it for a handful of servers. For many targets or long retention, a Veloxa 4 (4 vCPU, 8 GB RAM, 160 GB disk) at $30 a month, billed at $0.05 an hour and capped at the monthly price, gives more memory and disk.
Commands and settings checked on 2026-10-19 against the official documentation: prometheus.io, grafana.com, caddyserver.com. Software changes; if a step no longer matches, the vendor's docs win.
Ready to deploy?
Start a free trial, or compare plans to match your team's scale.