In the world of modern infrastructure, visibility isn't just a luxury—it's a requirement. If you aren't monitoring your systems, you're essentially flying blind. Prometheus has emerged as the industry standard for open-source monitoring and alerting, specifically designed for reliability and handling multi-dimensional data
In this post, we’ll walk through a manual installation of Prometheus on an Ubuntu server, ensuring you understand every moving part of the process.Prerequisites
Before we dive into the installation, let’s define our playground. For this guide, we’ll be using:- Operating System: Ubuntu 24.04 LTS
- Infrastructure: An AWS EC2 Instance (t3.micro or larger is sufficient for testing).
- Security Groups: Ensure your EC2 security group has Port 9090 open to your IP address so you can access the dashboard later.
- Access: SSH access to your instance with
sudoprivileges.
Step 1: Downloading Prometheus
Before we touch the server, we need the right binaries. While we could useapt-get, installing from the official source ensures we have the latest features and total control over our versioning.Head over to the Prometheus download page. Within the download block, choose the appropriate Prometheus binary version for your operating system. We can download it to our local machine, or more efficiently, grab the link and pull it directly to our ubuntu server using
wget.$ wget https://github.com/prometheus/prometheus/releases/download/v3.9.1/prometheus-3.9.1.linux-amd64.tar.gz$ ls -lStep 2: Extracting the Tarball
Once confirmed, we need to unpack the tarball by running the following command:$ tar xvf prometheus-3.9.1.linux-amd64.tar.gzxvf flags stand for eXtact, Verbose (show files as they extract), and File.To ensure the extraction was successful, list your files again. You should see a folder containing all Prometheus files.
Step 3: Exploring the Prometheus Directory
Once extracted, move into the new directory (cd prometheus-*). We'll see several files. Understanding what these are is key to managing our server:prometheus: The actual "engine" or server executable.prometheus.yml: The brain of the operation. This configuration file defines what to monitor and how often.promtool: A CLI utility used to verify that our config files are error-free before we restart the service.Step 4: Starting Prometheus
To start Prometheus, simply execute the binary from within the folder:$ ./prometheusIf successful, your terminal will start streaming logs. Look for these two specific milestones:
msg="TSDB started": This means the Time Series Database is initialized and ready to write data.msg="Server is ready to receive web requests.": This means the internal web server is live.If you do not see any errors, your Prometheus server is running successfully.
Step 5 - Accessing the Dashboard
Prometheus provides a built-in Expression Browser. By default, it listens on Port 9090. Open your browser.Navigate to
http://your-server-ip:9090.The best way to see if Prometheus is working is to ask it if it can see itself. In the query bar, type the following and hit Execute:
up{instance="localhost:9090", job="prometheus"}Value of 1: Everything is healthy. Prometheus is successfully "scraping" its own performance metrics.
Value of 0: Prometheus is running, but it's failing to collect data from itself (likely a configuration or networking issue).
Value of 0: Prometheus is running, but it's failing to collect data from itself (likely a configuration or networking issue).
Pro-Tips for Production
While running./prometheus works for a lab, here are two things we should do for a professional setup:- Use Systemd: Create a service file so Prometheus starts automatically when the server reboots.
- External Storage: By default, Prometheus stores data in the
./datafolder where you ran the command. In production, use the--storage.tsdb.pathflag to point this to a dedicated high-performance disk.