Install Prometheus on Ubuntu 17.10

In this article we will install Prometheus on Ubuntu Server.  Prometheus is a monitoring solution that monitors and alerts from time-series metrics.

Setting Up

I created a VM with 4 vCPUs and 4G of memory.  Install Ubuntu Server 17.10 and install all the updates.

# apt update && apt upgrade -y
# reboot

Installing Prometheus On Ubuntu

Now we need to download Prometheus.  At the time of this writing the latest version of Prometheus is 2.2.1 so we will download that version.

# wget --no-check-certificate https://github.com/prometheus/prometheus/releases/download/v2.2.1/prometheus-2.2.1.linux-amd64.tar.gz

Extract the tarbal and change to the new directory

# tar -xzvf prometheus-2.2.1.linux-amd64.tar.gz
# cd prometheus-2.2.1.linux-amd64

Starting Prometheus

Run the following command to start prometheus:

# ./prometheus --config.file=prometheus.yaml

You can now access the dashboard at the following URL:

http://{server_ip}:9090

Promethus Dashboard

Configuring SystemD

Lastly to finish our install Prometheus on Ubuntu, we need to configure Prometheus to run as a SystemD service.

# mkdir /etc/prometheus
# cp prometheus.yaml /etc/prometheus
# cd ..
# mv prometheus-2.2.1.linux-amd64 /usr/local/bin/prometheus

Create a new file /etc/systemd/system/prometheus.service and add the following contents:

[Unit]
Description=Prometheus
Documentation=https://prometheus.io/

[Service]
ExecStart=/usr/local/bin/prometheus/prometheus --config.file=/etc/prometheus/prometheus.yaml
ExecReload=/bin/kill -HUP $MAINPID
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

Start the service

# systemctl start prometheus.service
# systemctl enable prometheus.service
# systemctl status prometheus.service

You should see the service is active and running.

You now know how to install Promethus on Ubuntu 17.10

More great articles on AdminTome Blog.

Conclusion

I hope you have enjoyed this article, if so please leave a comment below.  For more articles, please signup for the AdminTome Blog below.  Also please feel free to share the article to your friends using the buttons to the left.  Thanks again for reading this post.