Alloy install
Jump to navigation
Jump to search
#!/usr/bin/env bash set -euo pipefail # 1. Ensure running as root if [[ $EUID -ne 0 ]]; then echo "Please run as root or with sudo." exit 1 fi # 2. (Optional) Check Ubuntu version . /etc/os-release if [[ "$VERSION_ID" != "24.04" ]]; then echo "Warning: This is tailored for Ubuntu 24.04 but you're on $PRETTY_NAME." fi # 3. Install prerequisites apt-get update apt-get install -y gpg wget gnupg # 4. Add Grafana APT repo and GPG key mkdir -p /etc/apt/keyrings wget -q -O - https://apt.grafana.com/gpg.key \ | gpg --dearmor \ | tee /etc/apt/keyrings/grafana.gpg > /dev/null cat <<EOF | tee /etc/apt/sources.list.d/grafana.list deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main EOF # 5. Update and install Alloy apt-get update apt-get install -y alloy # 6. Enable and start the service systemctl daemon-reload systemctl enable --now alloy echo echo "✔ Grafana Alloy has been installed and started." echo "→ Check status with: systemctl status alloy"