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
Leave a Comment