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

guide

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

A complete guide to self-hosting Grafana on a VPS: install, configure, and secure Grafana step by step, with recommended specs and common gotchas.

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

Grafana is a powerful open-source analytics and monitoring platform designed to visualize data from various data sources. Self-hosting Grafana can be an excellent solution for developers and homelabbers who require control over their data visualization setup. In this guide, we will walk you through the steps required to install Grafana on a Virtual Private Server (VPS).

Choosing Your VPS Provider

Before we dive into the installation, you need to select a VPS provider. Here is a brief comparison of some popular options:

ProviderMonthly PriceRAMCPUStorage
Contabo VPS5.99 EUR4 GB2 vCPU200 GB SSD
Hetzner Cloud4.15 EUR2 GB1 vCPU20 GB SSD
DigitalOcean6 USD2 GB1 vCPU50 GB SSD
Vultr6 USD2 GB1 vCPU55 GB SSD
Linode5 USD4 GB2 vCPU80 GB SSD

For this guide, we recommend using Hetzner Cloud or Contabo VPS for their favorable pricing and resource allocation. For a full VPS comparison, visit full VPS comparison.

Step 1: Set Up Your VPS

  1. Create an Account: Sign up with your chosen VPS provider and create a new instance.
  2. Select OS: Choose a Linux distribution, preferably Ubuntu 20.04 or 22.04.
  3. Access Your VPS: Use SSH to connect to your server:
    ssh root@your_vps_ip

Step 2: Install Grafana

Using APT Repository

  1. Update Package List:

    sudo apt update
    sudo apt upgrade -y
  2. Install Required Packages:

    sudo apt install -y software-properties-common
  3. Add Grafana GPG Key and APT Repository:

    wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
    echo "deb https://packages.grafana.com/oss/release/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
  4. Install Grafana:

    sudo apt update
    sudo apt install grafana -y

Start and Enable Grafana

Run the following commands to start the Grafana service and enable it at boot:

sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Step 3: Configuring Grafana

Access Grafana Dashboard

Once Grafana is running, you can access it through your browser at http://your_vps_ip:3000. The default login is:

Setting Up Data Sources

  1. Navigate to Configuration > Data Sources.
  2. Add a Data Source: Choose from various options like Prometheus, MySQL, etc.
  3. Configure and Save: Enter the necessary connection details and save your settings.

Step 4: Visualization and Dashboards

Now that your data source is configured, you can create visualizations:

  1. Go to Dashboards > New Dashboard.
  2. Add Panels: Select the type of visualization you want to create (graphs, tables, etc.).
  3. Customize: Modify your panels to reflect the data and metrics important for your monitoring needs.

Optional: Running Grafana in a Docker Container

If you prefer to manage Grafana within Docker, follow these steps:

  1. Install Docker:

    sudo apt install docker.io -y
    sudo systemctl enable docker
    sudo systemctl start docker
  2. Run the Grafana Container:

    sudo docker run -d -p 3000:3000 grafana/grafana

Access Grafana at http://your_vps_ip:3000 as described above.

FAQ

What are the benefits of self-hosting Grafana?

Self-hosting Grafana allows for greater control over data and server settings. You can customize the environment, manage security settings, and ensure compliance with data regulations. Additionally, self-hosting enables you to extend Grafanaโ€™s capabilities through plugins and custom configurations tailored to your development needs.

Can I use Grafana with any database?

Grafana supports many data sources, including time-series databases like InfluxDB, Prometheus, and relational databases like MySQL and PostgreSQL. This versatility makes it suitable for various applications, whether for monitoring metrics from IoT devices or visualizing performance data from applications.

How can I secure my Grafana installation?

Securing your Grafana installation involves several best practices:

By following these steps, you will have a robust self-hosted Grafana setup on your VPS. Enjoy visualizing your data efficiently!