./prometheus) launches it in the foreground. If you close that terminal, Prometheus stops. It also won’t start automatically after a reboot. To run Prometheus like any other long‑running service — in the background and enabled at boot — create a dedicated systemd unit and a system user that owns the Prometheus files.
This guide walks through:
- creating a system user and directories
- installing the Prometheus binaries and configuration
- creating a systemd unit file
- starting and enabling the service
1. Create a Prometheus user
Create a system user that cannot log in interactively. This user will own and run the Prometheus process.Using
--no-create-home and /bin/false prevents shell login for the prometheus user. This is a security best practice for service accounts.2. Create directories and set permissions
Create directories for configuration and time series storage, then assign ownership to theprometheus user and group.
After you copy files (next steps), make sure the directories and files are owned by the prometheus user:
3. Download and extract Prometheus
Download the Prometheus release and extract it.4. Install binaries and copy supporting files
Copy theprometheus binary and the promtool CLI to /usr/local/bin, and copy consoles and config files into /etc/prometheus.
consoles and console_libraries provide optional local web UI templates. If you are not using these right away, copying them still ensures the web UI works later without additional steps.5. Test running Prometheus as the prometheus user
You can test the exact command the systemd unit will run:6. Create the systemd service unit
Create/etc/systemd/system/prometheus.service with the contents below. This unit ensures Prometheus starts after the network is available and runs under the prometheus user.
Wants=network-online.targetandAfter=network-online.targetensure the network is up before Prometheus starts.User/Groupset the service account;Type=simpleis sufficient for Prometheus.ExecStartis the full command to run Prometheus with the correct paths.

7. Reload systemd, start and enable Prometheus
After adding or changing unit files, reload systemd and start the service:If
systemctl status prometheus reports failures, inspect the journal for details: sudo journalctl -u prometheus -b. Common issues include incorrect file paths, file ownership, or an invalid prometheus.yml.8. Troubleshooting tips
- Confirm
prometheusbinary location:which prometheusorls -l /usr/local/bin/prometheus. - Confirm config file syntax:
promtool check config /etc/prometheus/prometheus.yml. - Check logs:
sudo journalctl -u prometheus -fto tail live logs.
References
- Prometheus releases: https://github.com/prometheus/prometheus/releases
- systemd documentation: https://www.freedesktop.org/wiki/Software/systemd/