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.
[[email protected] ~]# cat /etc/redhat-release
Then check ip address using below command.
[[email protected] ~]# ip r
Step #02: create script.sh file and insert command.
[[email protected] ~]# 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
[[email protected] ~]# lsblk
Check your server interface name using below command.
[[email protected] ~]# ip a
Then see your interface name.
If any error so please see my YouTube channel for more videos.
- How To Install Odoo 16 on Ubuntu 22.04 - May 14, 2023
- 12 Steps to Organize Photos on Your Computer - March 20, 2023
- 9 Ways to Speed Up Your MacBook Yosemite - February 21, 2023
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.