Skip to main content
This guide walks through installing MikroTik Cloud Hosted Router (CHR) on an Debian-based EDBB VPS.
You’ll download the latest CHR image, inject an autorun script, write the image to the VPS disk, and reboot straight into RouterOS.
Winbox is then used to complete the initial configuration.

1. Prepare the VPS

  1. Reinstall the VPS with a clean Debian 12 environment using the EDBB Control Panel.
  2. Boot the VPS and connect via SSH.

2. Create the Installation Script

  1. Create a new script file (example name: install_chr.sh):
nano install_chr.sh
  1. Paste the following script provided by EDBB:
install_chr.sh
#!/bin/bash
set -euo pipefail

# Include sbin paths
export PATH="$PATH:/usr/bin:/bin:/usr/sbin:/sbin"

# Auto-detect target disk (vda vs sda)
if [ -b /dev/vda ]; then
  export TARGET_DISK=/dev/vda
elif [ -b /dev/sda ]; then
  export TARGET_DISK=/dev/sda
else
  echo "ERROR: Neither /dev/vda nor /dev/sda found. Available disks:" >&2
  lsblk -d -o NAME,SIZE,TYPE >&2
  exit 1
fi
echo "Using TARGET_DISK=$TARGET_DISK"

sudo apt-get update && sudo apt-get upgrade -y
# add parted for partprobe; util-linux provides fdisk
sudo apt-get -y install gzip unzip curl wget util-linux ca-certificates parted

# Latest stable RouterOS v7
latest_version="$(curl -fsSL https://download.mikrotik.com/routeros/NEWESTa7.stable | awk '{print $1}')"

# CHR RAW disk image
ZIP="chr-${latest_version}.img.zip"
IMG="chr-${latest_version}.img"
download_url="https://download.mikrotik.com/routeros/${latest_version}/${ZIP}"

# Download + extract
wget -O "$ZIP" "$download_url"
rm -f "$IMG"
unzip -o "$ZIP" "$IMG"

# Attach image with partition scan
LOOP="$(sudo losetup --find --show --partscan "$IMG")"
sudo udevadm settle 2>/dev/null || true
lsblk "$LOOP"

cleanup() {
  set +e
  sudo umount /mnt/image 2>/dev/null || true
  sudo losetup -d "$LOOP" 2>/dev/null || true
}
trap cleanup EXIT

# Mount partition for injection:
# Prefer p2 first (typically main filesystem) then p1
sudo mkdir -p /mnt/image
MOUNTED=0
for p in "${LOOP}p2" "${LOOP}p1"; do
  [ -b "$p" ] || continue
  if sudo mount "$p" /mnt/image 2>/dev/null; then
    if sudo sh -c 'touch /mnt/image/.writetest && rm -f /mnt/image/.writetest'; then
      MOUNTED=1
      echo "Mounted writable partition: $p"
      break
    fi
    sudo umount /mnt/image
  fi
done

if [ "$MOUNTED" != "1" ]; then
  echo "ERROR: Could not mount a writable partition inside CHR image ($IMG)." >&2
  exit 1
fi

sync
sudo umount /mnt/image
sudo losetup -d "$LOOP"
trap - EXIT

# Write CHR image to disk
echo u | sudo tee /proc/sysrq-trigger >/dev/null
sudo dd if="$IMG" bs=4M of="$TARGET_DISK" status=progress conv=fsync
sudo sync

# Verify layout best-effort
sudo partprobe "$TARGET_DISK" 2>/dev/null || true
lsblk "$TARGET_DISK" || true
sudo fdisk -l "$TARGET_DISK" 2>/dev/null || true

echo s | sudo tee /proc/sysrq-trigger >/dev/null

echo "Waiting 5 seconds..."
end_time=$((SECONDS + 5))
while [ $SECONDS -lt $end_time ]; do :; done

echo "Reboot OS"
echo b | sudo tee /proc/sysrq-trigger >/dev/null
  1. Save the file (Ctrl + O, Enter) and exit (Ctrl + X).

3. Run the Installer

chmod +x install_chr.sh
sudo ./install_chr.sh
The VPS will reboot automatically after installation.

Configure RouterOS manually

  1. Open your VPS service in the client area.
  2. Enable VNC and connect via noVNC or a VNC client.
  3. Sign in to RouterOS with user admin and a blank password.
  4. Set a new password for the admin account.
  5. Identify the network interface:
/interface print
  1. Using the network details from your billing panel, configure the IP address (example values shown):
/ip address add address=212.166.2.100/24 interface=ether1
  1. Configure the default route (gateway example shown):
/ip route add gateway=212.166.2.1 dst-address=0.0.0.0/0
  1. Set DNS servers:
/ip dns set servers=1.1.1.1,1.0.0.1
  1. After configuration, connect to RouterOS using Winbox.

4. Connect with Winbox

After the VPS restarts, it will boot into MikroTik RouterOS:
  1. Download Winbox from mikrotik.com/download.
  2. Launch Winbox and create a new session:
    • Connect To: public IPv4 address of the VPS.
    • Login: admin
    • Password: enter password.
    • Click Connect.
You now have a clean MikroTik CHR deployment on EDBB infrastructure, ready for routing, firewall, and VPN services.