How to Install Prometheus on Ubuntu
- Last Updated On: October 18, 2023
- By: Aswin Vijayan
Learn how to install Prometheus on Ubuntu with our easy-to-follow guide. Perfect for beginners to get your monitoring setup in no time.
Prometheus is an open-source monitoring and alerting system for collecting, storing, and querying metrics data from multiple systems and applications.
Let’s see how to install Promethus on Ubuntu, follow the below steps to install Promethus.
Step 1: Update and upgrade your system using the command given below.
sudo apt update && sudo apt upgrade -y
Step 2: Download Prometheus and extract the files using the command.
wget https://github.com/prometheus/prometheus/releases/download/v2.37.6/prometheus-2.37.6.linux-amd64.tar.gz
tar -xvf prometheus-2.37.6.linux-amd64.tar.gz
mv prometheus-2.37.6.linux-amd64 prometheus
Step 3: Create a user Prometheus using the command given below.
sudo useradd --no-create-home --shell /bin/false prometheus
Step 4: Create a Prometheus folder in two locations and change their owner permissions to Prometheus user.
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus
Step 5: Copy prometheus and promtool files to the bin and change the ownership to prometheus user.
sudo cp prometheus/prometheus /usr/local/bin/
sudo cp prometheus/promtool /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool
Step 6: Then copy the consoles and console_libraries folder to the prometheus folder and change the ownership to promethus.
sudo cp -r prometheus/consoles /etc/prometheus
sudo cp -r prometheus/console_libraries /etc/prometheus
sudo chown -R prometheus:prometheus /etc/prometheus/consoles
sudo chown -R prometheus:prometheus /etc/prometheus/console_libraries
Step 7: Now copy the prometheus.yml file inside the prometheus folder and change the ownership to promethus.
sudo cp prometheus/prometheus.yml /etc/prometheus
Step 8: Create a prometheus service file and copy the below content in it.
sudo vi /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
--config.file /etc/prometheus/prometheus.yml \
--storage.tsdb.path /var/lib/prometheus/ \
--web.console.templates=/etc/prometheus/consoles \
--web.console.libraries=/etc/prometheus/console_libraries
[Install]
WantedBy=multi-user.target
Now reload to make the changes and start Prometheus.
sudo systemctl daemon-reload
sudo systemctl start prometheus
Step 9: Check the status of promethus if it’s running or not.
sudo systemctl status prometheus
Step 10: Now access Prometheus UI in the browser by using the server IP along with the default port number 9090. You can see your UI in the browser as shown below.
You can use the search tab to search for available metrics as shown below.
Note: Linux Foundation offers a Prometheus certification called Prometheus Certified Associate (PCA). You can check our Linux Foundation Coupon page to get up to 50% discount on the PCA certification.
Aswin Vijayan
Other Interesting Blogs
[80% OFF] Linux Foundation Coupon for December 2024
Looking for CKA Coupon and other Linux Foundation certifications coupons? We got you covered. With the latest Linux Foundation Coupon, you can
[65% OFF] Linux Foundation LFCA, LFCS & LFCT Exam Voucher Codes
Linux Foundation has announced up to a $284 discount on its Linux certification programs Linux Foundation Certified IT Associate (LFCA) and Linux
Best Black Friday Deals For Techies in 2024
In this blog, we have listed down all the best Black Friday deals and Cyber Monday deals for techies. This is the