更新grub配置文件:

 

    1. 下载 Debian netboot mini.iso 到’/boot‘文件夹内.
       
      1
      wget -qO /boot/mini.iso https://moeclub.org/get-deb-livecd
    2. 在/boot文件夹/子目录内寻找GRUB配置文件.

       

      • 如果GRUB的配置文件为’grub.cfg’:
        在文件的末尾添加
         
        1
        2
        3
        4
        5
        6
        menuentry “Boot mini” {
        set isoimage=”/boot/mini.iso”
        loopback loop (hd0,1)$isoimage
        linux (loop)/linux auto=true LANG=en_US.UTF-8 KEYTABLE=us netcfg/dhcp_options=”Configure network manually” netcfg/dhcp_failed=note netcfg/get_nameservers=8.8.8.8 hostname=MoeClub domain=MoeClub.org — quiet
        initrd (loop)/initrd.gz
        }

        如果不好添加,就直接用echo的方式,简单暴力:

         
         
        echo -ne ‘menuentry “Boot mini” {\n\tset isoimage=”/boot/mini.iso”\n\tloopback loop (hd0,1)$isoimage\n\tlinux (loop)/linux auto=true LANG=en_US.UTF-8 KEYTABLE=us netcfg/dhcp_options=”Configure network manually” netcfg/dhcp_failed=note netcfg/get_nameservers=8.8.8.8 hostname=MoeClub domain=MoeClub.org — quiet\n\tinitrd (loop)/initrd.gz\n\t}\n\n’ >>/boot/grub/grub.cfg
      • 如果GRUB的配置文件为’grub.conf’:
         
        1
        #自行修改对应的部分.
    3. 获取本机的IP,子网掩码,网关并记录下来.
      一般控制台最下面有这些参数.
      如果没办法获取到这三项参数,可以用以下命令获取.
      代码片段摘自 Debian(Ubuntu)网络安装/重装一键脚本
       
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      25
      26
      27
      28
      29
      30
      31
      32
      33
      34
      35
      DEFAULTNET=”$(ip route show |grep -o ‘default via [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.*’ |head -n1 |sed ‘s/proto.*\|onlink.*//g’ |awk ‘{print $NF}’)”
      [ -n "$DEFAULTNET" ] && IPSUB=”$(ip addr |grep ”${DEFAULTNET}” |grep ‘global’ |grep ‘brd’ |head -n1 |grep -o ‘[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}/[0-9]\{1,2\}’)”
      IPv4=”$(echo -n “$IPSUB” |cut -d’/’ -f1)”
      NETSUB=”$(echo -n “$IPSUB” |grep -o ‘/[0-9]\{1,2\}’)”
      GATE=”$(ip route show |grep -o ‘default via [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}’ |head -n1 |grep -o ‘[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}’)”
      [ -n "$NETSUB" ] && MASK=”$(echo -n ’128.0.0.0/1,192.0.0.0/2,224.0.0.0/3,240.0.0.0/4,248.0.0.0/5,252.0.0.0/6,254.0.0.0/7,255.0.0.0/8,255.128.0.0/9,255.192.0.0/10,255.224.0.0/11,255.240.0.0/12,255.248.0.0/13,255.252.0.0/14,255.254.0.0/15,255.255.0.0/16,255.255.128.0/17,255.255.192.0/18,255.255.224.0/19,255.255.240.0/20,255.255.248.0/21,255.255.252.0/22,255.255.254.0/23,255.255.255.0/24,255.255.255.128/25,255.255.255.192/26,255.255.255.224/27,255.255.255.240/28,255.255.255.248/29,255.255.255.252/30,255.255.255.254/31,255.255.255.255/32′ |grep -o ‘[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}’${NETSUB}” |cut -d’/’ -f1)”
      [ -n "$GATE" ] && [ -n "$MASK" ] && [ -n "$IPv4" ] || {
      ipNum() {
        local IFS=’.’
        read ip1 ip2 ip3 ip4 <<<”$1″
        echo $((ip1*(1<<24)+ip2*(1<<16)+ip3*(1<<8)+ip4))
      }
      SelectMax(){
      ii=0
      for IPITEM in `route -n |awk -v OUT=$1 ‘{print $OUT}’ |grep ‘[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}’`
        do
          NumTMP=”$(ipNum $IPITEM)”
          eval “arrayNum[$ii]=’$NumTMP,$IPITEM’”
          ii=$[$ii+1]
        done
      echo ${arrayNum[@]} |sed ‘s/\s/\n/g’ |sort -n -k 1 -t ‘,’ |tail -n1 |cut -d’,’ -f2
      }
      [[ -z $IPv4 ]] && IPv4=”$(ifconfig |grep ‘Bcast’ |head -n1 |grep -o ‘[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}’ |head -n1)”
      [[ -z $GATE ]] && GATE=”$(SelectMax 2)”
      [[ -z $MASK ]] && MASK=”$(SelectMax 3)”
      }
      PubIPv4=”$(wget -qO- checkip.amazonaws.com)”
      [ -n "$IPv4" ] && [ -n "$PubIPv4" ] && {
      [ "$IPv4" != "$PubIPv4" ] && IPv4=”$(echo “$IPv4; $PubIPv4″)”
      }
      [ -n "$GATE" ] && [ -n "$MASK" ] && [ -n "$IPv4" ] && {
      echo -e “IPv4:\t\033[33m$IPv4\033[0m\nMASK:\t\033[33m$MASK\033[0m\nGATE:\t\033[33m$GATE\033[0m”
      } || {
      echo “Error! Not found network config. “
      }
    4. 进入VNC界面,然后在SSH终端输入重启命令.
      在VNC界面中可以看到启动菜单,选择’Boot mini‘

      安装WINDOWS镜像:

 

    • 此时进入Debian的安装界面,注意对话框顶部.
      • 如果出现的是
        Download debconf preconfiguration file
        请按两次ESC键,选择倒数第二个:
        Execute a shell
        选中Continue,并按回车
      • 如果出现的是
        Configure the network
        请按要求填入网络参数,等待出现
        Download debconf preconfiguration file
        按两次ESC键,选择倒数第二个:
        Execute a shell
        选中Continue,并按回车
    • 使用ls /dev命令可查看硬盘状况
      可知DigitalOcean机器的硬盘为’/dev/vda‘
    • 接下使用dd命令进行应用镜像,也可以使用自己的镜像.
       
      1
      wget -O- http://vps.4he.net/windows2008.R2.raw |dd of=/dev/vda
    • 待完成后,输入reboot命令
      就可看到久违的WINDOWS启动界面.按照正常步骤安装.
    • 安装完成后,如果没有网络,你需要自行完善网络配置.
    • 远程桌面服务如果没有意外,我提供的镜像会自动打开.

提示:在安装步骤时鼠标位置不好找,可能不太适应.
请尝试使用空格键回车键Tab键方向键进行操作.

  • 在磁盘管理中,点击’C‘盘,右键选择’扩展卷‘,可以直接’增加‘C盘的空间.
首页

No Comments Now!

Be the first to comment on this entry.

留下评论

姓名(必填)
Mail (必填),(will not be published)
站点(recommended)

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://www.directadmin.cc/blog),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.