Skip to content

Instantly share code, notes, and snippets.

@ertugrulturan
Last active June 11, 2024 06:13
Show Gist options
  • Save ertugrulturan/d532db68dcaf55247c67d70e5154afc9 to your computer and use it in GitHub Desktop.
Save ertugrulturan/d532db68dcaf55247c67d70e5154afc9 to your computer and use it in GitHub Desktop.
RouterOS Install Ubuntu 20.04/22.04 Server
#!/bin/bash
wget https://download.mikrotik.com/routeros/7.13.3/chr-7.13.3.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 ens18 | 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment