How to Install VictoriaMetrics on Linux Mint

VictoriaMetrics is a high-performance, open-source time-series database and monitoring solution. This tutorial will guide you through the steps to install VictoriaMetrics on Linux Mint, the latest edition.

Prerequisites:

Install VictoriaMetrics

  1. Open the terminal window by pressing the Ctrl+Alt+T shortcut.

  2. Update the package manager and upgrade any outdated packages by running the following command:

    sudo apt update && sudo apt upgrade
    
  3. Install the Prometheus server as a prerequisite for VictoriaMetrics by running the following command:

    sudo apt install prometheus
    
  4. Download the latest VictoriaMetrics release from https://github.com/VictoriaMetrics/VictoriaMetrics/releases/ using your preferred web browser.

  5. Extract the files from the downloaded archive. You may use your preferred archive manager or run the following command in the terminal to extract the files to a directory named victoriametrics:

    tar -xf victoriametrics-vx.x.x-linux-amd64.tar.gz -C victoriametrics --strip-components=1
    

Replace vx.x.x with the version number you have downloaded.

  1. Copy the extracted contents to the /usr/local/bin/ directory by running the following command:

    sudo cp victoriametrics/victoria-metrics-* /usr/local/bin/
    
  2. Create a system user and group for VictoriaMetrics to run as a non-root service. Run the following command to create the user and group:

    sudo useradd --system --home-dir /var/lib/victoriametrics --shell /usr/sbin/nologin victoriametrics
    
  3. Create the data directory and change the ownership to the previously created user and group:

    sudo mkdir -p /var/lib/victoriametrics/data
    sudo chown -R victoriametrics:victoriametrics /var/lib/victoriametrics
    
  4. Modify the permissions for the /var/lib/victoriametrics directory to allow Prometheus to scrape data from VictoriaMetrics:

    sudo chmod go+rx /var/lib/victoriametrics
    
  5. Create a configuration file for VictoriaMetrics:

    sudo mkdir /etc/victoriametrics/
    sudo nano /etc/victoriametrics/vm.yml
    

    Add the following contents to the file:

    global:
      dataDir: /var/lib/victoriametrics/data/
      replicaLabels:
        - __address__
    
  6. Create a systemd service file for VictoriaMetrics:

    sudo nano /etc/systemd/system/victoriametrics.service
    

    Add the following contents to the file:

    [Unit]
    Description=VictoriaMetrics
    Wants=network-online.target
    After=network-online.target
    
    [Service]
    User=victoriametrics
    Group=victoriametrics
    Type=simple
    ExecStart=/usr/local/bin/victoria-metrics-prod \
        -storageDataPath=/var/lib/victoriametrics/data \
        -retentionPeriod=30d \
        -insertIgnoreErrors \
        -httpListenAddr=:8428
    Restart=always
    RestartSec=10
    
    [Install]
    WantedBy=multi-user.target
    

    Save and Exit the file.

  7. Reload the systemd daemon and start the VictoriaMetrics service:

    sudo systemctl daemon-reload
    sudo systemctl start victoriametrics
    
  8. Enable VictoriaMetrics to start automatically on boot:

    sudo systemctl enable victoriametrics
    

Conclusion

VictoriaMetrics has been installed on your Linux Mint workstation. You can now access the metrics data by opening a web browser and visiting http://localhost:8428/metrics. You should see a page listing the available metrics.

You may use VictoriaMetrics for various use-cases such as:

Congratulations, you have successfully installed VictoriaMetrics on Linux Mint.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!