How to Guide – Setup RouterOS (Mikrotik) on your Server

Contents

    This article assumes you are already logged into your VPS/Dedicated Server. Don’t have an account with us, feel free to sign up over at our Portal. Once registered check out our selection of VPS and Dedicated Servers.
    Already have one? Then feel free to proceed to follow the how-to guide below.

    Important – this is destructive and irreversible. Installing CHR overwrites the entire disk, wiping your Linux OS and all data on it. Back up anything you need first. Once written, the only way back to Linux is a fresh OS reload from your control panel. Do not run this on a server holding data you care about, spin up a fresh VPS for it instead.

    Before You Begin – Use the Console, Not SSH

    Because this process overwrites the running operating system, your SSH connection will drop the instant the disk is rewritten. If the write has not finished by then, you are left with an unbootable server. For this reason we strongly recommend running the whole procedure from the noVNC / HTML5 console in your Packetra client area rather than over SSH. From the console you can watch the write finish and the reboot happen, with no session to drop mid-way.

    You will find the console under your service in the client portal. Log into your Linux server there as cloudvpsXXX/root before continuing.

    Select your Linux OS to Prepare the Tools

    First, install the two tools we need, wget to download the image and unzip to extract it. Select the tab matching the OS your VPS is currently running.

    • Ubuntu
    • Debian
    • AlmaLinux

    # Update the system and install the download and extract tools
    apt update
    apt install -y wget unzip

    # Update the system and install the download and extract tools
    apt update
    apt install -y wget unzip

    # Update the system and install the download and extract tools
    dnf install -y wget unzip

    Download & Extract the CHR Image into RAM

    We download the image into /dev/shm, which is a RAM-backed folder. This matters because we are about to overwrite the disk, the source image needs to live somewhere that isn’t the disk we are wiping. Keeping it in RAM means the write can read the image cleanly right up to the end.

    cd /dev/shm
    wget https://download.mikrotik.com/routeros/7.21.5/chr-7.21.5.img.zip -O chr.zip
    unzip chr.zip

    MikroTik ships CHR as a .zip archive, so it must be extracted with unzipnot gunzip. Using gunzip returns “unknown suffix — ignored” and leaves you with an unextracted file. If you then write that to disk, the router will boot to “XZ-compressed data is corrupt”. Always use unzip.

    Verify the Image Before Writing

    This one check saves the most common failure. Confirm the extracted file is a real disk image and note its exact name (the version number may differ from the example).

    ls -la
    file chr-7.21.5.img

    The file command must report something like DOS/MBR boot sector or data. If it says Zip archive, the extract did not happen, go back and run unzip again. Do not proceed until this reports a boot sector.

    Identify Your Target Disk

    Next, find the disk your server boots from, this is the device we write CHR onto. It is usually vda or sda, but you must confirm rather than assume, as writing to the wrong device will fail.

    lsblk

    Example: a line reading sda   25G disk with a partition sda1 mounted at / tells you the boot disk is /dev/sda. Use the whole disk (sda), not the partition (sda1). Note the name for the next step.

    Booting mode: CHR uses a legacy BIOS boot layout. All Packetra VPS boot in BIOS (SeaBIOS) mode, so this works out of the box there is no action needed. If you run this method elsewhere on a UEFI-only machine, CHR will write fine but fail to boot, because the write removes the EFI partition.

    Write the Image and Reboot into RouterOS

    Now write the image to the disk. Replace chr-7.21.5.img with the exact filename from the verify step, and /dev/sda with the disk you confirmed with lsblk. The sync flushes the write, then echo b forces an immediate reboot into RouterOS.

    dd if=/dev/shm/chr-7.21.5.img of=/dev/sda bs=4M conv=notrunc oflag=direct
    sync
    echo b > /proc/sysrq-trigger

    The console will freeze briefly, then you will see the server reboot. SeaBIOS loads, and within a few seconds RouterOS starts. Watch the console, you are looking for the RouterOS banner and a login prompt.

    First Login & Configure Networking

    At the RouterOS prompt, log in with username admin and an empty password (just press Enter). You will be prompted to set a new password immediately, do this as your server is on a public IP.

    CHR does not pick up your old Linux network settings, so set them manually. Use the IP address, subnet and gateway shown for your service in the client portal. The example below uses placeholders — substitute your own values.

    ip address add address=YOUR_IP/PREFIX interface=ether1
    ip route add gateway=YOUR_GATEWAY
    ip dns set servers=1.1.1.1,9.9.9.9

    Example: for an IP of 203.0.113.50 with a /27 subnet and gateway 203.0.113.33, the first line would read ip address add address=203.0.113.50/27 interface=ether1 and the route ip route add gateway=203.0.113.33.

    These settings are saved immediately and persist across reboots — RouterOS has no separate “save” step. Verify connectivity:

    ip address print
    ping YOUR_GATEWAY count=3
    ping 1.1.1.1 count=3

    If both pings reply, your router is online. You can now manage it over SSH, or download WinBox from MikroTik for a full graphical interface.

    Secure & Name Your Router

    RouterOS enables several management services by default. Since your router faces the public internet, disable the ones you do not need and set a clear identity.

    # See what is running, then disable the insecure/unused services
    ip service print
    ip service disable telnet,ftp,api,api-ssl
    
    # Give the router a recognisable name
    system identity set name=my-router

    This leaves SSH and WinBox available. If you connect from a fixed IP, you can restrict WinBox to it with ip service set winbox address=YOUR_HOME_IP for an extra layer of security.

    Final Words

    You now have a full MikroTik RouterOS router running on your Packetra server, installed directly from Linux with no special tooling. This suits anyone who wants complete control over routing, firewalling and VPN termination at a hosting IP, using the same interface as MikroTik’s hardware routers. From here you can build WireGuard or IPsec tunnels, set up firewall rules, or shape traffic, all from within RouterOS.

    Frequently Asked Questions

    Do I need a licence to run CHR?
    CHR runs for free on its default licence, which caps each interface at 1 Mbit/s of throughput. That is plenty for a router control plane, management, and light use. If you need real bandwidth, MikroTik sells paid CHR licences (P1, P10 and unlimited tiers) that you apply from within RouterOS. Buy a licence keyed to your system ID shown under system license print.

    The router boots to “XZ-compressed data is corrupt”. What happened?
    The image written to disk was damaged or incomplete. This is almost always caused by using gunzip instead of unzip, or by writing before the extract finished. Reload Linux, then repeat the steps making sure the file command reports a boot sector before you run dd.

    My SSH session froze and dropped during the write. Did it fail?
    No, that is expected. The moment dd overwrites the running OS, SSH has nothing to talk to and drops. This is exactly why we recommend using the console instead, so you can watch the reboot into RouterOS complete.

    Good to Know
    Always run this from the noVNC console rather than SSH, and always verify the extracted image with the file command before writing. Those two habits prevent the vast majority of failed installs. Keep the CHR image in /dev/shm so the write can read it cleanly while overwriting the disk. If you ever want to go back to a standard Linux VPS, simply reload the OS from your control panel, which wipes CHR and restores a clean install. Run into any issues? Open a support ticket through the client portal and our team will help you.

    Updated on July 17, 2026
    Was this article helpful?