Bachelor Tech
  • Home
  • Tutorials
  • Tips
  • Portfolio
  • About Jan
  • Contact Jan

1. Prepare your VM (Debian)

by Jan Bachelor February 6, 2026

Assuming that you are using a vanilla Debian 13 image, we will need some packages:

su -
apt install sudo
usermod -aG sudo your_username
exit

# Log out and back in for sudo group to take effect

In case you would like to set up a custom SSH port, do the following after logging in again:

sudo nano /etc/ssh/sshd_config
# Find and uncomment + change to your preferred port number
Port 2222

# Save and exit the editor, restart SSH
sudo systemctl restart ssh
# Now you can connect to your custom port

At this point you could consider installing ufw or another local firewall. You would then need to ensure the ports that we mention below are opened.

Now let’s install docker and other dependencies:

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget git vim net-tools ca-certificates gnupg lsb-release

# Create a monitoring folder structure:
sudo mkdir -p /opt/monitoring/{data,config}
sudo mkdir -p /opt/monitoring/data/{prometheus,loki,grafana}
sudo chown -R $USER:$USER /opt/monitoring

If you use Ansible (or even AWX or Semaphore) for automation, remember to add your SSH key:

# 1. Create the 'ansible' user with no password.
# -m creates the /home/ansible directory.
# -s /bin/bash sets their shell.
sudo useradd -m -s /bin/bash ansible

# Lock the user - disable password-based login
sudo passwd -l ansible

# 2. Give the user passwordless sudo
sudo visudo
# Add this line at the very end of the file. Save and exit.
ansible ALL=(ALL) NOPASSWD: ALL

# 3. Create the .ssh directory and file as the 'ansible' user
sudo -u ansible mkdir /home/ansible/.ssh
sudo -u ansible chmod 700 /home/ansible/.ssh
sudo -u ansible touch /home/ansible/.ssh/authorized_keys
sudo -u ansible chmod 600 /home/ansible/.ssh/authorized_keys

# 4. Open the file and paste your key
sudo -u ansible nano /home/ansible/.ssh/authorized_keys
ssh-ed25519 your_pre-existing_key

# Paste the key from the clipboard. Save & exit.

Install Docker using the official Debian 13 method:

# Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL <https://download.docker.com/linux/debian/gpg> | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the repository
echo \\
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] <https://download.docker.com/linux/debian> \\
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \\
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Add your user to docker group (so you do not need sudo for docker commands)
sudo usermod -aG docker $USER

# Log out and back in, then verify
docker --version
docker compose version

Now when we have the basics, let’s set up our docker containers and start the fun!

2. Configure Docker Containers (Prometheus, Loki, Grafana)
Go back to course overview: Part 1: Ultimate metrics & logs monitoring with visualization using Loki, Prometheus and Grafana

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 FacebookWhatsappEmail

Course Steps

  1. 1. Prepare your VM (Debian)
  2. 2. Configure Docker Containers (Prometheus, Loki, Grafana)
  3. 3. Deploy Alloy to one host
  4. 4. Create a playbook to push Alloy to all hosts
  5. 5. Customize Grafana

Other courses

Turn your Raspberry Pi into a Proxmox Backup...

July 13, 2025

Create an automated Gravity workflow that will allow...

January 19, 2024

Dynamically Populate Gravity Forms from Google Sheets (GSheets...

March 16, 2021

Concur Alternative: Import Employees’ Credit Card Expenses to...

January 19, 2024

OPNSense in HA with CARP with dual WANs

June 30, 2025

Buy Me a Coffee

Buy Me a Coffee Buy Me a Coffee

Recent Posts

  • How to get LXC containers for Proxmox outside of ready-made templates

  • How to join two Proxmox nodes into a cluster (PVE 8.x)

  • How to Rename a Proxmox Node

All Rights Reserved. The theme was customized from Soledad, see PenciDesign

Bachelor Tech
  • Home
  • Tutorials
  • Tips
  • Portfolio
  • About Jan
  • Contact Jan