RouterOS is a network operating system based on the Linux kernel. It functions as a router with firewall, VPN server and client, and wireless access point. The system can serve as a customizable captive portal for a wireless access point. Additionally, MikroTik offers RouterOS images for use on virtual machines and cloud services, called the Cloud Hosted Router (CHR), available as a virtual machine image for various virtualization platforms.
RouterOS can be configured via a command-line interface accessible through serial port, Telnet, and Secure Shell (SSH), and through a graphical user interface available as a web-based interface (WebFig), a Windows-based application (Winbox), and apps for iOS and Android. An application programming interface (API) is also available for developing specialized monitoring and management applications.
This article explains how to install RouterOS using a Debian or Ubuntu server as the base system, automating the process with a script. The process is simple to apply, but it will completely replace the existing system, so it’s important to understand the implications.
First, access the server via SSH and log in as the root user. Then simply create the script using an editor:
# nano /tmp/script.sh
And add the following content to it:
#!/bin/bash mount -t tmpfs tmpfs /tmp/ wget https://download.mikrotik.com/routeros/6.48.6/chr-6.48.6.img.zip -O chr.img.zip gunzip -c chr.img.zip > /tmp/chr.img dd if=/tmp/chr.img of=/dev/sda bs=4M oflag=sync && \ sleep 1 && \ echo 1 > /proc/sys/kernel/sysrq && \ sleep 1 && \ echo b > /proc/sysrq-trigger
Save the changes and exit the editor. Then assign execution permissions to the script and run it as root:
# chmod 700 /tmp/script.sh && sh /tmp/script.sh
Once completed, the server will automatically reboot, and you should quickly log in via SSH as the admin user (with no password) to set a password:
# /user set admin password=X3UY2z54nzDH58C0
You can also do this from the RouterOS web interface on the server, but it’s important to do it as soon as possible to prevent brute-force login attempts.
Additionally, remember that you can use UserData to create the server directly by inserting the script. You can find more information in Adding UserData Scripts When Creating Your Server in Clouding.
We hope this article was helpful. If you have any questions about this or anything else related to your servers on Clouding, feel free to contact soporte@clouding.io. We're here to help!