Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

How to Self-Host Prometheus on a VPS (Complete Guide)

Learn how to self-host Prometheus on a VPS with a step-by-step guide covering installation, configuration, and securing Prometheus for reliable daily use.

How to Self-Host Prometheus on a VPS (Complete Guide)

Prometheus is a powerful open-source monitoring and alerting toolkit that is widely used for capturing metrics from various services. Self-hosting Prometheus on a VPS can give you complete control over your monitoring setup. In this guide, we will walk you through the process of installing Prometheus on a virtual private server (VPS), using Docker for easy management and deployment.

Step 1: Choosing a VPS Provider

Before we start, you need to select a VPS provider. Below is a comparison of some popular VPS options suitable for hosting Prometheus:

ProviderPrice (per month)FeaturesLink
Contabo VPS5.99 EURHigh RAM, SSD storageContabo
Hetzner Cloud4.15 EURExcellent performance, scalable solutionsHetzner Cloud
DigitalOcean6 USDEasy to use interface, generous creditsDigitalOcean
Vultr6 USDWide geographical locationsVultr
Linode (Akamai)5 USDSimple pricing, reliabilityLinode

For developers and homelabbers, Hetzner Cloud often stands out due to its competitive pricing and performance.

Step 2: Setting Up Your VPS

After selecting a VPS provider, spin up an instance with at least 1 GB of RAM and a decent CPU. Follow these server preparation steps:

  1. Connect to your server using SSH:

    ssh root@your_vps_ip
  2. Update your system:

    sudo apt update && sudo apt upgrade -y
  3. Install Docker:

    sudo apt install docker.io -y
  4. Start and enable Docker:

    sudo systemctl start docker
    sudo systemctl enable docker

Step 3: Install Prometheus Using Docker

With Docker installed, you can quickly deploy Prometheus in a container.

  1. Pull the official Prometheus Docker image:

    sudo docker pull prom/prometheus
  2. Create a configuration file for Prometheus. You can use the default configuration or create your own. Hereโ€™s a simple example:

    global:
      scrape_interval: 15s
    
    scrape_configs:
      - job_name: 'prometheus'
        static_configs:
          - targets: ['localhost:9090']
  3. Save this configuration as prometheus.yml.

  4. Run Prometheus with Docker:

    sudo docker run -d \
      -p 9090:9090 \
      --name prometheus \
      -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml \
      prom/prometheus
  5. Access Prometheus: Go to http://your_vps_ip:9090 in your web browser to see the Prometheus dashboard.

Step 4: Configuring Prometheus

Once Prometheus is running, you can begin to configure it further for your application metrics. Here are a few basic configurations:

Step 5: Storing Data

Prometheus uses a time-series database to store metrics data efficiently. By default, it stores data in-memory, but you can configure persistence options if necessary.

FAQs

How do I secure Prometheus on my VPS?

To secure your Prometheus instance, consider implementing the following steps:

This ensures that your data remains secure from unauthorized access.

Can I monitor other services with Prometheus?

Yes, one of the key strengths of Prometheus is its ability to scrape metrics from various services. You can monitor:

This flexibility allows for a comprehensive monitoring setup.

How can I set up alerts in Prometheus?

Prometheus can alert you based on rules defined in your configuration. Hereโ€™s how to set up basic alerts:

  1. Define Alerting Rules: Create a YAML file with your alert definitions. Example:

    groups:
    - name: example
      rules:
      - alert: HighLoad
        expr: job:load1:avg5m > 0.7
        for: 10m
        labels:
          severity: critical
        annotations:
          summary: "High load on instance {{ $labels.instance }}"
  2. Configure Alertmanager: Install and configure Alertmanager to handle alerts sent by Prometheus.

  3. Notification Channels: Set up notification channels (email, Slack) in Alertmanager for alert delivery.

For advanced configurations, refer to the Prometheus documentation.

Conclusion

Self-hosting Prometheus on a VPS provides a robust solution for monitoring your applications and infrastructure. With the steps outlined above, you can install, configure, and customize Prometheus to your needs. For a full VPS comparison, visit our full VPS comparison. Happy monitoring!