Prometheus is an open-source monitoring system and time-series database that helps to monitor service-level targets, collect and analyze metrics for resources. In this tutorial, we will show you the step-by-step process of installing Prometheus on Clear Linux Latest.
Before proceeding with the installation process of Prometheus, it is recommended that you update your system to the latest packages. You can update your Clear Linux by running the following command:
sudo swupd update
Prometheus is built using the Go programming language, so we need to install Go and Git. We can install them by running the following command:
sudo swupd bundle-add go-basic git
wget https://github.com/prometheus/prometheus/releases/download/v2.30.0/prometheus-2.30.0.linux-amd64.tar.gz
Note: Replace the link with the relevant link of your selected version.
tar -xvf prometheus-2.30.0.linux-amd64.tar.gz
sudo mv prometheus-2.30.0.linux-amd64 prometheus
sudo mv prometheus /usr/local/
It is recommended to run Prometheus as a non-root user for security purposes. Create a user and group for Prometheus by running the following command:
sudo useradd --no-create-home --shell /bin/false prometheus
Grant ownership permissions for the Prometheus directories to the prometheus user:
sudo chown -R prometheus:prometheus /usr/local/prometheus
We need to create a Prometheus Systemd service file to start Prometheus on system boot. Run the following command to create the service file:
sudo nano /etc/systemd/system/prometheus.service
Paste the following contents into the file:
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
ExecStart=/usr/local/prometheus/prometheus \
--config.file /usr/local/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/usr/local/prometheus/consoles \
--web.console.libraries=/usr/local/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
Reload Systemd to pick up the new service file.
sudo systemctl daemon-reload
Start Prometheus.
sudo systemctl start prometheus
Check the status of Prometheus by running the following command:
systemctl status prometheus
You should see the output indicating that Prometheus is active and running.
● prometheus.service - Prometheus
Loaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2022-02-22 03:43:34 UTC; 14s ago
Main PID: 708863 (prometheus)
Tasks: 7 (limit: 235854)
Memory: 41.7M
CPU: 357ms
CGroup: /system.slice/prometheus.service
└─708863 /usr/local/prometheus/prometheus --config.file /usr/local/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.templates=/usr/local/prometheus/consoles --web.console.libraries=/usr/local/prometheus>
You have successfully installed Prometheus on Clear Linux Latest. You can now configure Prometheus and use it to monitor your applications, servers, and services.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!