Skip to main content
Version: 7.26

CHR: Proxmox VE Installation

Proxmox VE runs virtual machines with KVM/QEMU. CHR runs on it from the raw disk image, converted to the qcow2 format. Run the commands on this page in the shell of the Proxmox host. The installation script does all the steps in one run.

Install CHR step by step​

Step 1: Create a virtual machine​

  • Create a new virtual machine in the Proxmox VE web interface.
  • Assign the CPUs, the memory and the network interfaces it needs (see the system requirements in CHR: Installation).
  • Do not install an operating system. You attach the CHR disk manually.

Step 2: Download and extract the CHR image​

Download the raw disk image from the MikroTik download page to the Proxmox host, and extract it. Set VERSION to the RouterOS version you want:

VERSION=7.x.y
wget https://download.mikrotik.com/routeros/$VERSION/chr-$VERSION.img.zip
unzip chr-$VERSION.img.zip

The archive contains the image chr-<version>.img.

Step 3: Convert the image into the storage of the virtual machine​

The default Proxmox local storage keeps the disks of a virtual machine in /var/lib/vz/images/<VM_ID>/. Create the directory if it does not exist, and convert the raw image to a qcow2 disk there, in the same shell as step 2 (the commands use $VERSION). Replace <VM_ID> with the ID of the virtual machine:

mkdir -p /var/lib/vz/images/<VM_ID>
qemu-img convert -f raw -O qcow2 chr-$VERSION.img \
/var/lib/vz/images/<VM_ID>/vm-<VM_ID>-disk-1.qcow2

The qcow2 disk has the size of the image (128 MiB). To give CHR more disk space, resize the disk in Proxmox before you start the virtual machine for the first time.

Step 4: Attach the disk to the virtual machine​

Attach the disk in the Proxmox web interface or in the configuration file of the virtual machine, /etc/pve/qemu-server/<VM_ID>.conf, and make it the boot disk.

tip

Try a change of the configuration file on a test virtual machine first, to check its syntax.

Installation script​

This Bash script runs on the Proxmox host. It:

  • creates the directory /root/temp,
  • downloads the CHR image of the version you enter, extracts it and converts it to qcow2,
  • creates a virtual machine with the ID you enter and attaches the disk as its boot disk.
#!/bin/bash

version="nil"
vmID="nil"

echo "############## Start of Script ##############"

if [ ! -d /root/temp ]; then
mkdir /root/temp
fi

read -p "Enter CHR version: " version

cd /root/temp

wget https://download.mikrotik.com/routeros/$version/chr-$version.img.zip
unzip chr-$version.img.zip

read -p "Enter VM ID: " vmID

mkdir -p /var/lib/vz/images/$vmID

qemu-img convert -f raw -O qcow2 \
chr-$version.img \
/var/lib/vz/images/$vmID/vm-$vmID-disk-1.qcow2

qm create $vmID \
--name chr-$version \
--net0 virtio,bridge=vmbr0 \
--bootdisk virtio0 \
--ostype l26 \
--memory 512 \
--sockets 1 \
--cores 1 \
--virtio0 local:$vmID/vm-$vmID-disk-1.qcow2

echo "############## End of Script ##############"

The script gives the virtual machine 512 MB of memory and one network adapter. Change --memory and add network adapters for a router in use.

If you copy the script through a Windows computer, remove the Windows line endings before you run it:

sed -i -e 's/\r$//' *.sh

Supported network adapters and disk controllers​

Network adapters:

  • VirtIO (paravirtualized)
  • Intel E1000
  • VMware vmxnet3

Disk controllers:

  • IDE
  • SATA
  • VirtIO Block
  • VirtIO SCSI

Prefer the VirtIO network adapter.

If IPv6 does not work through a Linux bridge of the host, see CHR: Troubleshooting.