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.
root@ubuntu:~# 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.
root@ubuntu:~# chmod 755 script.sh
Then run this file.
root@ubuntu:~# ./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.
Just one question: Will it work on version 20.04 or do I have to upgrade to 22.04?
Yes working
hi
when I run script I get this error
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error
can you help me???
I think you not install exact mikrotik version as my provided script.
Did not work for me. I have lost 5 servers while trying. Maybe because of the ARM architecture. Is it may be possible to make it work on ARM?
If I check your server then I confirm its working or not
That’s it! Thank you very much.
Welcome
this showed up:
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/loop3, missing codepage or helper program, or other error.
you can install using my script also exact mikrotik version. otherwise not working.
Hi
some vps providers dont support dhcp , please tell me how to set ip and gateway manually in your script
i tried some commands but not successful .
can you help me.
Yes, Please knock me from WA
Bro there are 2 users
but just one full access user named “System”
what’s the password?
First time admin user no any password setup, so after login then setup password first.