From 0e1dbdee2895d959ca14b521051e2cbf2cc84a5b Mon Sep 17 00:00:00 2001
From: Mathias Palmersheim <mathias@victoriametrics.com>
Date: Mon, 8 Jul 2024 08:47:24 -0500
Subject: [PATCH] Added Binary Install Docs (#6598)

### Describe Your Changes

Updated Quickstart guide for VIctoriaMetrics and VictoriaMetrics Cluster to include instructions for installing the binaries by hand

### Checklist

The following checks are **mandatory**:

- [ x] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).
---
 docs/Quick-Start.md | 244 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 242 insertions(+), 2 deletions(-)

diff --git a/docs/Quick-Start.md b/docs/Quick-Start.md
index f9ea00dd0b..cc889703bb 100644
--- a/docs/Quick-Start.md
+++ b/docs/Quick-Start.md
@@ -27,6 +27,7 @@ Single-server-VictoriaMetrics VictoriaMetrics is available as:
 * [Docker images](https://hub.docker.com/r/victoriametrics/victoria-metrics/)
 * [Helm Charts](https://github.com/VictoriaMetrics/helm-charts#list-of-charts)
 * [Binary releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/latest)
+* [Ansible Roles](https://github.com/VictoriaMetrics/ansible-playbooks)
 * [Source code](https://github.com/VictoriaMetrics/VictoriaMetrics).
   See [How to build from sources](https://docs.victoriametrics.com/single-server-victoriametrics/#how-to-build-from-sources)
 * [VictoriaMetrics on Linode](https://www.linode.com/marketplace/apps/victoriametrics/victoriametrics/)
@@ -40,7 +41,7 @@ and [Grafana setup](https://docs.victoriametrics.com/single-server-victoriametri
 VictoriaMetrics is developed at a fast pace, so it is recommended periodically checking the [CHANGELOG](https://docs.victoriametrics.com/changelog/) and performing [regular upgrades](https://docs.victoriametrics.com/#how-to-upgrade-victoriametrics).
 
 
-### Starting VM-Single via Docker
+### Starting VictoriaMetrics Single via Docker
 
 The following commands download the latest available
 [Docker image of VictoriaMetrics](https://hub.docker.com/r/victoriametrics/victoria-metrics)
@@ -60,7 +61,7 @@ and read [these docs](https://docs.victoriametrics.com/#operation).
 There is also [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/)
 - horizontally scalable installation, which scales to multiple nodes.
 
-### Starting VM-Cluster via Docker
+### Starting VictoriaMetrics Cluster via Docker
 
 The following commands clone the latest available
 [VictoriaMetrics repository](https://github.com/VictoriaMetrics/VictoriaMetrics)
@@ -79,6 +80,245 @@ See more details [here](https://github.com/VictoriaMetrics/VictoriaMetrics/tree/
 
 * [Cluster setup](https://docs.victoriametrics.com/cluster-victoriametrics/#cluster-setup)
 
+
+### Starting VictoriaMetrics Single from a Binary
+
+1. Download the correct archive from [github](https://github.com/VictoriaMetrics/VictoriaMetrics/releases)
+
+For open source it will look like
+
+  ```victoria-metrics-<os>-<architecture>-v<version>.tar.gz```
+
+For Enterprise it will look like
+
+  `victoria-metrics-<os>-<architecture>-v<version>-enterprise.tar.gz`
+
+In order for VictoriaMetrics Enterprise to start the, the -license flag must be set equal to a valid VictoriaMetrics key or the -licenseFile flag needs to point to a file containing your VictoriaMetrics license. Please, see more information about license configuration [here](https://docs.victoriametrics.com/enterprise/#binary-releases).
+
+2. Extract the archive to /usr/local/bin by running
+
+`sudo tar -xvf <victoriametrics-archive> -C /usr/local/bin`
+
+Replace victoriametrics-archive with the path to the archive you downloaded in step 1
+
+3. Create a VictoriaMetrics user on the system
+
+`sudo useradd -s /usr/sbin/nologin victoriametrics`
+
+4. Create a folder for storing VictoriaMetrics data
+
+`mkdir -p /var/lib/victoria-metrics && chown -R victoriametrics:victoriametrics /var/lib/victoria-metrics`
+
+
+5. Create a Linux Service by running the following
+
+```bash
+cat <<END >/etc/systemd/system/victoriametrics.service
+[Unit]
+Description=VictoriaMetrics service
+After=network.target
+
+[Service]
+Type=simple
+User=victoriametrics
+Group=victoriametrics
+ExecStart=/usr/local/bin/victoria-metrics-prod -storageDataPath=/var/lib/victoria-metrics -retentionPeriod=90d -selfScrapeInterval=10s
+SyslogIdentifier=victoriametrics
+Restart=always
+
+PrivateTmp=yes
+ProtectHome=yes
+NoNewPrivileges=yes
+
+ProtectSystem=full
+
+[Install]
+WantedBy=multi-user.target
+END
+```
+
+If you want to deploy VictoriaMetrics single as a Windows Service review the [running as a windows service docs](https://docs.victoriametrics.com/single-server-victoriametrics/#running-as-windows-service)
+
+6. Adjust the command line flags in the `ExecStart` line to fit your needs.
+
+The list of command line flags for VictoriaMetrics can be found [here](https://docs.victoriametrics.com/single-server-victoriametrics/#list-of-command-line-flags)
+
+7. Start and enable the service by running
+
+`sudo systemctl daemon-reload && sudo systemctl enable --now victoriametrics.service`
+
+8. Check the that service started successfully 
+
+`sudo systemctl status victoriametrics.service`
+
+9. After VictoriaMetrics is Running verify VMUI is working by going to `http://<ip_or_hostname>:8428/vmui`
+
+
+### Starting VictoriaMetrics Cluster from Binaries
+
+On all nodes you will need to do the following
+
+1. Download the archive that matches your operating system and processor architecture from [github releases](https://github.com/VictoriaMetrics/VictoriaMetrics/releases)
+
+For open source it will look like
+
+  `victoria-metrics-<os>-<architecture>-v<version>-cluster.tar.gz`
+
+For Enterprise versions of VictoriaMetrics the ar will look like 
+
+  `victoria-metrics-<os>-<architecture>-v<version>-enterprise-cluster.tar.gz`
+
+In order for VictoriaMetrics Enterprise to start the, the -license flag must be set equal to a valid VictoriaMetrics key or the -licenseFile flag needs to point to a file containing your VictoriaMetrics license. Please, see more information about license configuration [here](https://docs.victoriametrics.com/enterprise/#binary-releases).
+
+
+2. Extract the archive to /usr/local/bin by running
+
+`sudo tar -xvf <victoriametrics-archive> -C /usr/local/bin`
+
+Replace victoriametrics-archive with the path to the archive you downloaded in step 1
+
+3. Create a user account for VictoriaMetrics
+
+`sudo useradd -s /usr/sbin/nologin victoriametrics`
+
+##### vmstorage
+
+1. Create a folder for storing VictoriaMetrics data
+
+`mkdir -p /var/lib/vmstorage && chown -R victoriametrics:victoriametrics /var/lib/vmstorage`
+
+2. Create a Linux Service for `vmstorage` service by running 
+
+```bash
+cat <<END >/etc/systemd/system/vmstorage.service
+[Unit]
+Description=VictoriaMetrics vmstorage service
+After=network.target
+
+[Service]
+Type=simple
+User=victoriametrics
+Group=victoriametrics
+Restart=always
+ExecStart=/usr/local/bin/vmstorage-prod -retentionPeriod=90d -storageDataPath=/var/lib/vmstorage
+
+PrivateTmp=yes
+NoNewPrivileges=yes
+ProtectSystem=full
+
+[Install]
+WantedBy=multi-user.target
+END
+```
+
+3. Adjust the command line flags in the ExecStart line to fit your needs.
+
+The list of command line flags for `vmstorage` can be found [here](https://docs.victoriametrics.com/cluster-victoriametrics/#list-of-command-line-flags-for-vmstorage)
+
+4. Start and Enable `vmstorage`
+
+`sudo systemctl daemon-reload && systemctl enable --now vmstorage`
+
+5. Check that the service is running
+
+`sudo systemctl status vmstorage`
+
+6. After `vmstorage` is running confirm the service healthy by going to
+
+
+`http://<ip_or_hostname>:8482/-/healthy`
+
+It should say "VictoriaMetrics is Healthy"
+
+##### vminsert
+
+1. Create a Linux Service for `vminsert` by running
+
+```bash
+cat << END >/etc/systemd/system/vminsert.service
+[Unit]
+Description=VictoriaMetrics vminsert service
+After=network.target
+
+[Service]
+Type=simple
+User=victoriametrics
+Group=victoriametrics
+Restart=always
+ExecStart=/usr/local/bin/vminsert-prod -replicationFactor=1 -storageNode=localhost
+
+PrivateTmp=yes
+NoNewPrivileges=yes
+ProtectSystem=full
+
+[Install]
+WantedBy=multi-user.target
+END
+```
+
+2. Adjust the command line flags in the ExecStart line to fit your needs.
+
+The list of command line flags for `vminsert` can be found [here](https://docs.victoriametrics.com/cluster-victoriametrics/#list-of-command-line-flags-for-vminsert).
+
+3. Start and enable `vminsert`
+
+`sudo systemctl daemon-reload && sudo systemctl enable --now vminsert.service`
+
+4. Make sure `vminsert` is running
+
+`sudo systemctl status vminsert.service`
+
+5. After `vminsert` is started you can confirm that is healthy by going to
+
+`http://<ip_or_hostname>:8480/-/healthy`
+
+It should say "VictoriaMetrics is Healthy"
+
+##### vmselect
+
+1. Create a folder to store query cache data `sudo mkdir -p /var/lib/vmselect-cache && sudo chown -R victoriametrics:victoriametrics /var/lib/vmselect-cache`
+
+2. Add a Linux Service for `vmselect` by running
+
+```bash
+cat << END >/etc/systemd/system/vmselect.service
+[Unit]
+Description=VictoriaMetrics vmselect service
+After=network.target
+
+[Service]
+Type=simple
+User=victoriametrics
+Group=victoriametrics
+Restart=always
+ExecStart=/usr/local/bin/vmselect-prod -storageNode localhost -cacheDataPath=/var/lib/vmselect-cache
+
+PrivateTmp=yes
+NoNewPrivileges=yes
+
+ProtectSystem=full
+
+[Install]
+WantedBy=multi-user.target
+END
+```
+
+3. Adjust the command line flags in the ExecStart line to fit your needs.
+
+The list of command line flags for `vmselect` can be found [here](https://docs.victoriametrics.com/cluster-victoriametrics/#list-of-command-line-flags-for-vmselect)
+
+4. Start and enable `vmselect`
+
+`sudo systemctl daemon-reload && sudo systemctl enable --now vmselect.service`
+
+5. Make sure the `vmselect` service is running
+
+`sudo systemctl status vmselect.service`
+
+6. After `vmselect` is running you can verify it is working by going to VMUI located at
+
+`http://<ip_or_hostname>:8481/select/vmui/vmui/`
+
 ## Write data
 
 There are two main models in monitoring for data collection: