This guide explains how to install and configure Prometheus with a Systemd unit for secure and optimized operation.
In this guide, you will learn how to set up Prometheus with a dedicated Systemd unit. We cover creating a dedicated user, configuring directories and permissions, copying binaries, adding console assets, and configuring the Prometheus service to run automatically. Follow these steps to ensure your Prometheus installation is secure and optimized.
If you have not already downloaded and extracted the Prometheus binaries, download them using wget and extract the archive. Verify your working directory by listing its contents:
Copy
Ask AI
ls
For example, your output may look like:
Copy
Ask AI
Desktop Documents Downloads Music Pictures prometheus-2.37.2.linux-amd64 prometheus-2.37.2.linux-amd64.tar.gz Public snap Templates Videos
Change into the extracted directory and check its contents:
Copy
Ask AI
cd prometheus-2.37.2.linux-amd64ls -l
A typical output should be similar to:
Copy
Ask AI
total 206288drwxr-xr-x 2 user1 user1 4096 Nov 4 07:24 console_librariesdrwxr-xr-x 9 user1 user1 4096 Nov 4 07:15 consolesdrwxr-xr-x 9 user1 user1 4096 Nov 4 07:15 data-rw-r--r-- 1 user1 user1 2245 Nov 4 07:24 LICENSE-rw-r--r-- 1 user1 user1 3773 Nov 4 07:24 NOTICEdrwxr-xr-x 2 user1 user1 4096 Nov 4 07:09 prometheus-rw-r--r-- 1 user1 user1 2001 Nov 4 07:24 prometheus.yml-rw-r--r-- 1 user1 user1 101509240 Nov 4 07:11 promtool
Prometheus uses console templates and libraries for its web UI. Copy the consoles and console_libraries directories to /etc/prometheus and update their permissions:
Open your web browser and navigate to http://localhost:9090 to access the Prometheus UI. This confirms that the service is up and running and that you can start monitoring your systems.This completes the Prometheus installation and configuration process. For additional information, refer to the official Prometheus Documentation.