How To Convert Centos 7 Server To MikroTik Router Using Script3 min read
In this tutorial how to convert Centos 7 server to MikroTik router using bash script. MikroTik is a popular router for every ISP. MikroTik provides many installation process like iso, image file, chr and more. So in this tutorial using chr image.
★ How To Setup ZFS Storage Pool On Ubuntu 14.04
★ How To Add Windows Host In Zabbix Server
Step #01: Check server operating system version using below command.
[root@localhost ~]# cat /etc/redhat-release
Then check ip address using below command.
[root@localhost ~]# ip r
Step #02: create script.sh file and insert command.
[root@localhost ~]# vi script.sh
Now insert below all lines into this file.
#!/bin/bash wget https://download.mikrotik.com/routeros/6.44.6/chr-6.44.6.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 eth1 | 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 " > /mnt/rw/autorun.scr && \ umount /mnt && \ echo u > /proc/sysrq-trigger && \ dd if=chr.img bs=1024 of=/dev/xvda && \ echo "sync disk" && \ echo s > /proc/sysrq-trigger && \ echo "Sleep 5 seconds" && \ sleep 5 && \ echo "Ok, reboot" && \ echo b > /proc/sysrq-trigger
Then press Esc type :wq then press Enter for save file.
Remember : Must be change eth1 and /dev/xvda as your own server interface name and disk name otherwise not properly install this script.
Check your server disk name
[root@localhost ~]# lsblk
Check your server interface name using below command.
[root@localhost ~]# ip a
Then see your interface name.
If any error so please see my YouTube channel for more videos.
- How To Install Zabbix Server 6.4 On AlmaLinux 8 Server - August 9, 2024
- How To Clear RAM Memory Cache Buffer Linux Server - February 29, 2024
- How To Install Apache Cloud Stack Management Server 4.17 On Ubuntu 22.04 - February 1, 2024
We really appreciate for your support for buying me a coffee.
It takes us a while to compose and upload new content, as they have to be checked to see if Properly works. We appreciate you if you help me for one cup of coffee to keep us awake and always deliver good quality content.
No contribution is small of an amount. We are grateful for any amount you support us with. Thank you!
when script run show this error :
mount: /dev/loop0 is write-protected, mounting read-only
check disk name is ok, Thanks.
The problem persists after checking the disk name. I dont see the same entries as in your storage list. instead mine is /dev/vda1 and 2
You add your disk name ? Thanks.