How To Install MikrotiK Router On Ubuntu 22.04 Server Using Script
In this tutorial how to convert linux server to MikroTik router using script. How to install MIkroTik router using script on ubuntu 22.04 server or desktop.
My server info: ###################################### IP address : 10.66.10.6 Operating System: Ubuntu 22.04 RAM : 2 GB Disk : 25 GB vCPU : 2 CPU op-mode(s) : 64-bit Service : Mikrotik Router Hostname (FQDN) : ubuntu https://mikrotik.com/download ######################################
Step #01: Create script.sh file or open using any editor.
[email protected]:~# vi script.sh
Insert below all line into this file.
#!/bin/bash wget https://download.mikrotik.com/routeros/7.5/chr-7.5.img.zip -O chr.img.zip && \ gunzip -c chr.img.zip > chr.img && \ mount -o loop,offset=512 chr.img /mnt && \ ADDRESS=`ip addr show enp0s3 | grep global | cut -d' ' -f 6 | head -n 1` && \ GATEWAY=`ip route list | grep default | cut -d' ' -f 3` && \ echo "/ip address add address=$ADDRESS interface=[/interface ethernet find where name=ether1] /ip route add gateway=$GATEWAY /ip service disable telnet /user set 0 name=root password=xxxxxx" echo u > /proc/sysrq-trigger && \ dd if=chr.img bs=1024 of=/dev/sda && \ echo "sync disk" && \ echo s > /proc/sysrq-trigger && \ echo "Sleep 5 seconds" && \ sleep 5 && \ echo "Ok, reboot" && \ echo b > /proc/sysrq-trigger
Then save press Esc type :wq then press Enter.
Step #02: Setup executable permission on script file.
[email protected]:~# chmod 755 script.sh
Then run this file.
[email protected]:~# ./script.sh
If you see any error please see my YouTube video for more details. Don’t forget subscribe my channel and share to other.