Skip to main content
This guide walks through installing Prometheus as a systemd service on a Linux host. You’ll create a non-login system user, set up directories, install binaries and console files, deploy a systemd unit, and start the service. Follow the steps in order to ensure correct ownership and permissions. Quick overview:
  • Create a system user for Prometheus (non-login).
  • Create directories for configuration and data.
  • Install Prometheus binaries and console files.
  • Set ownership and permissions.
  • Install the Prometheus systemd service and start it.
Prerequisites
  • A Linux system with sudo privileges.
  • A Prometheus tarball downloaded from the official site (see links below), or the binaries available locally.
  • Basic familiarity with systemd, users, and file permissions.
Useful links Table: resources created by this guide
  1. Create the prometheus user and directories
Create a non-login system user and the directories used by Prometheus:
  1. Set ownership for the directories
Assign ownership of the new directories to the prometheus user and group so Prometheus can read/write appropriately:
  1. Install the Prometheus binaries
If you have not yet downloaded Prometheus, fetch the latest tarball from the official downloads page and extract it. Example using wget and tar:
From inside the extracted Prometheus directory, copy the prometheus and promtool binaries to /usr/local/bin and set ownership and executable permissions:
  1. Install console files and the Prometheus configuration
Copy the consoles and console_libraries directories into /etc/prometheus so the web UI templates are available:
Set ownership recursively so the prometheus user can read these files:
Copy your Prometheus configuration file (prometheus.yml) into place and set ownership:
Make sure the configuration filename you copy matches the path referenced by the systemd service (below we reference /etc/prometheus/prometheus.yml). Also ensure the prometheus binary is executable and owned by the prometheus user.
  1. Create the systemd service file
Create /etc/systemd/system/prometheus.service with the following contents. This unit uses the common startup options and paths used above:
Save the file after editing. If you use a different config path or binary location, update ExecStart accordingly.
Important: Ensure the --config.file and --storage.tsdb.path values in the systemd unit point to the exact files/directories you created. Mismatched paths are a common cause of startup failures.
  1. Reload systemd, start and enable the service
Reload systemd so it picks up the new unit, then start and enable Prometheus to run at boot:
  1. Verify Prometheus is running
Check the service status:
Look for an active (running) status. If there are problems, follow the logs to debug:
Common issues and quick fixes Example: verify config syntax with promtool:
  1. Access the Prometheus web UI
Open your browser to: http://localhost:9090 If you’re accessing remotely, replace localhost with your server IP or DNS name and ensure port 9090 is allowed through any firewall. If you need to adjust the listening address or port, see the Prometheus flags in the official docs. References and further reading End of lesson.

Watch Video