自用DD脚本分享,亲测可用!

脚本一

原文:https://www.hostloc.com/thread-645870-1-1.html

支持重装的系统:

  • Debian 9/10
  • Ubuntu 18.04/16.04
  • CentOS 6/7
  • 自定义DD镜像

特性/优化:

  • 自动获取IP地址、网关、子网掩码
  • 自动判断网络环境,选择国内/外镜像,再也不用担心卡半天了
  • 超级懒人一键化,无需复杂的命令
  • 解决萌咖脚本中一些导致安装错误的问题
  • CentOS 7 镜像抛弃LVM,回归ext4,减少不稳定因素
wget --no-check-certificate -O AutoReinstall.sh https://git.io/AutoReinstall.sh && bash AutoReinstall.sh

默认密码 Pwd@CentOS Pwd@Linux

脚本二

原文:https://sunpma.com/137.html

说明

  • 无限制全自动dd安装Windows
  • 突破没有VNC,没有救援模式,内存比dd包小的限制
  • 使用Debian Live CD中的busybox做中间媒介,经过复杂的处理使本机的网络参数传进Windows操作系统中
  • 即使没有DHCP能够让Windows获取网络参数,也能让Windows操作系统在开机的第一时间能够连通网络

特别注意:OpenVZ构架不适用

安装

apt-get install -y xz-utils openssl gawk file
yum install -y xz-utils openssl gawk file

 

如果出现错误,请运行

apt-get update
yum update

一键脚本

 

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd '[Windows dd包直连地址]'

 

精简版DD包

选择好版本,输入以下一键脚本即可

#DD Windows Server 2003 32位 精简版 [账户Administrator密码cxthhhhh.com]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1j9ow8dsIA7DucsGpDI-kzJwiNW9kMceT'

 

#DD Windows Server 2008 R2 64位 精简版 [账户Administrator密码WinSrv2008x64-Chinese]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1DTps9WwC6RZ8szflais8YazpkCVdqdI7'

#DD Windows Server 2012 R2 64位 精简版 [账户Administrator密码WinSrv2012r2x64-Chinese]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1KTzROA2eWTHC8qWUG2Vr-onuRTwaIOSe'

#DD Windows Server 2019 Datacenter 64位 精简版 [账户Administrator密码WinSrv2019dc-Chinese]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1NbOzolHsDGbp3gJ3TeQ9_4qkmSLIuO07'

#DD Windows7 32位 精简版 [账户Administrator密码Windows7x86-Chinese]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/15NkZxVdkcx2P9cFez9gxkqVEQksKMrx1'

#DD Windows7 sp1 64位 旗舰精简版 自带IIS [账户Administrator密码www.nat.ee]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1KA9PDH4T2ODbxS97T6MtTk5TwifQQoIp'

#DD Windows7 64位 旗舰精简版 [账户Administrator密码www.nat.ee]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1C9Y0Iu1pGX4-blb_3G49jOqv13Zeka6-'

#DD Windows10 64位 企业精简版 2019LTSC [账户Administrator密码www.nat.ee]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1pUNKV0nQvFXDZYJnfq2FzEfQNCZ3_5g7'

 

完整版DD包

#DD Windows Server 2012 R2 Datacenter 64位 完整版 [账户administrator密码Password147]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1bfXS59h0y8Ibz5o84DvcBMfqhP0d12Ib'

#DD Windows Server 2016 Datacenter 64位 完整版 [账户administrator密码Password147]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1CElbDjEXrjPIX4GpdRBwRXBWTtSHOwzi'

#DD Windows Server 2019 Datacenter 64位 完整版 [账户administrator密码Password147]

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1gRIT702MrVzLr8Bmk8OF-_Ckp02_tOxE'

 

Oracle甲骨文

此DD包仅适用于Oracle甲骨文DD Win使用

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh -dd 'https://api.moeclub.org/GoogleDrive/1NHKdm3xfQ3HySNCGvrzgdz7RMVCI1qGy'

 

网路参数安装

比如GCP谷歌云Azure微软云OVH云服务器等需要指定网络参数安装的方式,示例为GCP谷歌云

# 将X.X.X.X替换为自己的网络参数

# --ip-addr :IP Address/内网IP地址

# --ip-mask :Netmask /子网掩码

# --ip-gate :Gateway /网关

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh --ip-addr X.X.X.X --ip-mask X.X.X.X --ip-gate X.X.X.X -dd 'DD包 直链地址'

例:
DD Windows 7 64位 精简旗舰版 只需替换--ip-addr后面的X.X.X.X为你自己的内网IP即可,其他不变
在GCP谷歌云Debian Ubuntu测试成功CentOS未测试
默认账户Administrator密码www.nat.ee

GCP谷歌云-台湾

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh --ip-addr X.X.X.X --ip-mask 255.255.255.0 --ip-gate 10.140.0.1 -dd 'https://api.moeclub.org/GoogleDrive/1C9Y0Iu1pGX4-blb_3G49jOqv13Zeka6-'

GCP谷歌云 香港

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && bash InstallNET.sh --ip-addr X.X.X.X --ip-mask 255.255.255.0 --ip-gate 10.170.0.1 -dd 'https://api.moeclub.org/GoogleDrive/1C9Y0Iu1pGX4-blb_3G49jOqv13Zeka6-'

连接上后如果遇到无法打开网页的情况,修改DNS即可

8.8.8.8

8.8.4.4

    备用链接  ==>  展开 / 收缩

 

脚本指导三

原文地址:https://vircloud.net/operations/linux-to-windows.html#selection-261.0-261.9

 

Linux VPS 重装为 Windows 系统即所谓的 dd win,通过萌咖大佬的一键脚本,即可实现一键无人值守将 Linux 系统重装成你想要的 Windows 系统。

优点

  • 无需多硬盘!
  • 无需大内存!
  • 无需 VNC / IPMI!
  • GCP、AWS、Azure、DO、VultrCloudCone 等等几乎所有的 KVM、XEN、Hyper 架构云服务器均支持!

局限

方法

通用

创建云主机时,系统选择 Debian 9,开通后通过 SSH 或 VNC 连接到云主机,然后在 root 模式下输入以下命令:

bash <(wget --no-check-certificate -qO- \
'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') \
-dd "https://image.moeclub.org/GoogleDrive/1OVA3t-ZI2arkM4E4gKvofcBN9aoVdneh" \
--ip-addr "10.140.0.8" \
--ip-gate "10.140.0.1" \
--ip-mask "255.255.240.0"

参数说明

-dd:dd 镜像直链地址,即要安装的 windows 镜像地址,注意不是 iso 镜像;
--ip-addr: 主机内网 IP 地址;
--ip-gate: 主机内网网关地址;
--ip-mask:主机内网子网掩码。

dd 镜像:

萌咖大佬制作,安装完毕后,请尽快更新账户信息,远程登陆账号为:Administrator,远程登陆密码为:Vicer

# win7emb_x86.tar.gz:
https://image.moeclub.org/GoogleDrive/1srhylymTjYS-Ky8uLw4R6LCWfAo1F3s7
https://moeclub.org/onedrive/IMAGE/Windows/win7emb_x86.tar.gz
# win8.1emb_x64.tar.gz:
https://image.moeclub.org/GoogleDrive/1cqVl2wSGx92UTdhOxU9pW3wJgmvZMT_J
https://moeclub.org/onedrive/IMAGE/Windows/win8.1emb_x64.tar.gz
# win10ltsc_x64.tar.gz:
https://image.moeclub.org/GoogleDrive/1OVA3t-ZI2arkM4E4gKvofcBN9aoVdneh
https://moeclub.org/onedrive/IMAGE/Windows/win10ltsc_x64.tar.gz

其他

如果不确定主机 IP,但确定主机可以通过 DHCP 获得 IP,则可直接通过下列命令进行 ddwin:

bash <(wget --no-check-certificate -qO- \
'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') \
-dd "https://image.moeclub.org/GoogleDrive/1OVA3t-ZI2arkM4E4gKvofcBN9aoVdneh"

大陆主机则可以添加加速 mirror 参数以提升下载速度:

bash <(wget --no-check-certificate -qO- \
'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') \
-dd "https://image.moeclub.org/GoogleDrive/1OVA3t-ZI2arkM4E4gKvofcBN9aoVdneh" \
--mirror 'http://mirrors.ustc.edu.cn/debian/'

举例

CloudCone

wget --no-check-certificate -qO InstallNET.sh 'https://moeclub.org/attachment/LinuxShell/InstallNET.sh' && \
bash InstallNET.sh \
-dd 'https://image.moeclub.org/GoogleDrive/1OVA3t-ZI2arkM4E4gKvofcBN9aoVdneh' \
--ip-addr "公网 IP" \
--ip-gate "网关" \
--ip-mask "255.255.255.0"

说明
1、通过 ifconfig 或 ip route 命令即可查出 IP、网关等信息。
2、实测 IP 需要通过 VNC 登录手动再设置一遍。
3、首次启动会卡在 grub 引导界面,需要登录 VNC,手动输入 exit +回车 完成启动。
4、启动后,进入 C:\Boot\,新建文件夹 grub2,进入文件夹新建文本文件grub.cfg,输入并保存:

chainloader +1
boot

可以解决每次重启都卡在 grub 引导界面问题。

GCP

bash <(wget --no-check-certificate -qO- \
'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') \
-dd "https://image.moeclub.org/GoogleDrive/1OVA3t-ZI2arkM4E4gKvofcBN9aoVdneh" \
--ip-addr "10.2.0.11" \
--ip-gate "10.2.0.1" \
--ip-mask "255.255.255.0"

1、石头盘,配置选比较低的话实测系统运行会很卡。

Azure

bash <(wget --no-check-certificate -qO- \
'https://moeclub.org/attachment/LinuxShell/InstallNET.sh') \
-dd "https://image.moeclub.org/GoogleDrive/1OVA3t-ZI2arkM4E4gKvofcBN9aoVdneh" \
--ip-addr "10.0.0.4" \
--ip-gate "10.0.0.1" \
--ip-mask "255.255.255.0"

说明
1、石头盘,配置选比较低的话实测会很卡,还不如用 Azure 自带的 Windows 镜像;
2、符合免费政策的 Windows 启动模板可参考《Azure B1s 符合免费条件的 Windows 系统快速部署脚本模板》;

纯 IPv6 环境

参数基本一致,区别主要在 IP 的配置上,需要指定而不能使用自动检测,其中:

  • --ip-addr 和 --ip-gate 可以直接看 /etc/network/interfaces文件(不同系统位置可能不同);
  • --ip-mask 直接根据 https://www.ultratools.com/tools/rangeToipv6CIDR 计算,比如 /64 的掩码是 ::ffff:ffff:ffff:ffff
  • 还有一个是网关的配置,InstallNET.sh 默认是 8.8.8.8,需要改成 IPv6 的 DNS,比如 sed -ie "s@d-i netcfg/get_nameservers string 8.8.8.8@d-i netcfg/get_nameservers string 2001:4860:4860::8888@g" ./InstallNET.sh 

需要注意的是,有些 VPS 的 IPv6 网关不在计算的子网范围内,比如分配的 IP 为 1:2:3:4::1/64,但网关在 1:2:3:1::1,这种配置全新安装会出错。

原因是 1:2:3:4::1/64 表示子网范围:1:2:3:4:0:0:0:0 到 1:2:3:4:ffff:ffff:ffff:ffff,恰好网关不在此范围。因此全新安装 Debian 安装器会报错:网关地址无法到达。使用脚本需要调整 IP 参数为 1:2:3:4::1/48 (/48 可以省去),掩码参数为 ::ffff:ffff:ffff:ffff:ffff

问答

1、为什么没有应用商店、Edge 浏览器、Cortana 小娜......?
答:这是选用的 dd 包问题,像萌咖大佬的 dd 包里已经精简掉了,如果需要可以自行安装。如有条件,建议自己制作 dd 镜像,可以参考秋水逸冰大神的教程《如何制作 Windows Server 2019 的 DD 镜像》。

2、执行脚本,实例是 debian 9 的系统,每次运行到 99323 blocks 都停止运行?
答:这是正常现象,其实这时候 VPS 已经自动重启进行 Windows 安装了,耐心等待即可,如果 VPS 有 VNC 还可以连上去查看整个安装过程。

3、VNC 看到服务器一直卡在 Starting up the partitioner 没有进度?
答:这是正常的,linux dd win 在这一步进度条不会走,一般等半小时左右即可通过远程桌面连接,但像 Azure 这种石头盘的,依配置不同可能需要 3 小时甚至更久。总之只要命令没错,耐心等待就行了。

4、VPS 配置比较低,有没有最精简可以带的动的 dd 镜像呢?
答:总所周知,带 GUI 的系统一般都会比纯命令的系统更耗资源,所以既然要跑 Windows,为了体验,建议买配置性能稍稍好点的,最起码内存要大于 512MB。萌咖大佬的镜像都是基于微软官方精简版的系统(Win7:Thin PC,Win8.1:Embedded,Win10:iOT),也就是上面分享的三个 dd 镜像,可以根据需要选择安装。

5、启动时卡在 Logo 不动了?
答:目前主要出现在 Virmach,其采用的底层不兼容,其他商家基本上耐心等就可以了。

6、CloudCone 主机 DD 完进不了系统?
答:这是 CC 家架构问题,启动项在另一个地方,所以解决方法是,进入 VNC,在选择启动项时,输入 e,然后再在出现的命令行中输入 exit 就行了,一劳永逸的方法参见上文说明。另外不知道时脚本问题,还是 CC 问题,IP 无法通过命令设置,需要在 D 完后进 VNC 配置。

阅读剩余
THE END