群晖Virtual Machine Manager安装RoutesrOS

[复制链接]
查看: 1210   回复: 3
发表于 2023-6-5 02:18:50 | 显示全部楼层 |阅读模式
主要思路:VMM安装CentOS7后,dd RouterOS


个人操作,略绕,介意的可以直接centos7 --> ros:

1. 群晖安装Virtual Machine Manager.
2. Ubuntu官网下载完整版ISO镜像Ubuntu18 server //
    安装完成后,ssh登录;如果不能连接,可以vnc手动安装openssh server,重启后连接ssh //
    dd centos7 //

    安装好linux建议先修改为国内dns
  1. echo nameserver 223.5.5.5 > /etc/resolv.conf && echo nameserver 119.29.2
复制代码
3. CentOS7上dd RouterOS
    脚本下载后,解压扔到root下,给予0755权限后运行即可
  1. wget https://www.inkscloud.com/wp-content/uploads/2021/07/1627246350-7e08a36aac8e952.zipunzip 1627246350-7e08a36aac8e952.zipchmod +x RouterOS.s && ./RouterOS.sh
复制代码
代码:
  1. #!/bin/bash# VPS2RouterOS# https://github.com/Jamesits/vps2routeros# This script will cause permanent data loss# Please read the documentation prior to running this# You have been warned# ======================= please change these =================================# your network interface to internet# this is used to auto configure IPv4 after reboot# (this may not work for every device)# eth0 for most devices, ens3 for Vultr# you can use `ip addr` or `ifconfig` to find out this# default: the interface on the default routeMAIN_INTERFACE=$(ip route list | grep default | cut -d' ' -f 5)# HDD device (not partition)# May not be compatible with SCSI drives; see official document of RouterOS CHR# you can use `lsblk` to find out this# default: the disk with a partition mounted to `/`DISK=$(mount | grep ' / ' | cut -d' ' -f1 | sed 's/[0-9]*$//g')# get IPv4 address in IP-CIDR format# do not modify unless you know what you are doingADDRESS=$(ip addr show $MAIN_INTERFACE | grep global | cut -d' ' -f 6 | head -n 1)# get gateway IP# do not modify unless you know what you are doingGATEWAY=$(ip route list | grep default | cut -d' ' -f 3)# URL to RouterOS CHRROUTEROS_URL=https://download.mikrotik.com/routeros/6.48.1/chr-6.48.1.img.zip# Note: you can customize commands to be executed when RouterOS initializes.# Search `Auto configure script` below# do not modify that unless you know what you are doing# ======================= no need to modify below ============================set -euo pipefail# check if this script is running under rootif [[ $EUID -ne 0 ]]; then   echo "This script must be run as root" 1>&2   exit 1fi# https://stackoverflow.com/a/3232082/2646069confirm() {    # call with a prompt string or use a default    read -r -p "${1:-Are you sure? [y/N]} " response    case "$response" in        [yY][eE][sS]|[yY])             true            ;;        *)            false            ;;    esac}echo -e "Please confirm the settings:"echo -e "Installation destination: ${DISK}"echo -e "Network information:"echo -e "\tinterface: ${MAIN_INTERFACE}"echo -e "\tIPv4 address: ${ADDRESS}"echo -e "\tIPv4 gateway: ${GATEWAY}"echo -e "\nIf you continue, your disk will be formatted and no data will be preserved."confirm || exit -1echo "installing packages"yum -y install wgetecho "download image"wget ${ROUTEROS_URL} -O chr.img.zipecho "unzip image"gunzip -c chr.img.zip > chr.imgecho "mount image"mount -o loop,offset=512 chr.img /mntecho "Get address and gateway and assign variable"mkdir -p /mnt/rw\echo "/ip address add address=${ADDRESS} interface=[/interface ethernet find where name=ether1]/ip route add gateway=${GATEWAY}" > /mnt/rw/autorun.screcho "Unmount the image"umount /mntecho "Your old OS is being wiped while running, good luck"echo "If the device stopped responding for more than 30 minutes, please issue a reboot manually"sleep 5echo "write disk"echo u > /proc/sysrq-triggerecho "sync disk"dd if=chr.img bs=1024 of=${DISK}echo "wait a while"sleep 5 || echo "please wait 5 seconds and execute\n\techo b > /proc/sysrq-trigger\nmanually, or hard reset device"echo "rebooting"reboot
复制代码

4.winBox搜索局域网找到RouterOS,点击connet连接配置


以上全为借鉴,无任何原创
   https://post.smzdm.com/p/a5dn78pl
   https://www.right.com.cn/forum/forum-72-1.html
   https://www.inkscloud.com/archives/406
   https://www.inkscloud.com/wp-content/uploads/2021/07/1627246350-7e08a36aac8e952.zip[/code]
回复

使用道具 举报

发表于 2023-6-5 02:19:45 | 显示全部楼层
ubuntu DD centos
centos DD ros
我是真不会啊。。我问下。那为啥不直接装centos DD Ros呢?
回复 支持 反对

使用道具 举报

发表于 2023-6-5 02:20:00 | 显示全部楼层
告诉我,为什么要搞个垃圾pve?
服务器装windows不香吗?
回复 支持 反对

使用道具 举报

发表于 2023-6-5 02:20:06 | 显示全部楼层
那你仔细看下第二句话啊
我VMM常备装ubuntu,debian,;但是centos最烂的系统,如果没有必要,当然不安装
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则