LiuJia 发表于 2019-3-25 13:34:57

通过debian-installer远程dd安装Windows

系统:debian 9 64位。

过程:

1.apt install kexec-tools # 安装 kexec 热内核切换工具
https://alioss.anqun.org/typecho/2019/03/24/38786886642499.png

2.wget http://cdn-fastly.deb.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux # 下载 debian9 的网络安装文件

3.wget http://cdn-fastly.deb.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz # 下载 debian9 的网络安装文件

4.wget https://github.com/fincham/kexec-remote-debian-install/raw/master/build.py # 下载脚本,制作自动安装配置文件

5.vi build.py # 增加ntfs模块,ntfs-3g-udeb ntfs-modules-4.9.0-8-amd64-di fuse-modules-4.9.0-8-amd64-di
https://alioss.anqun.org/typecho/2019/03/24/38786665014592.png

6.chmod +x build.py # 增加执行权限

7../build.py initrd.gz enp0s20f0 144.172.126.32 255.255.255.0 144.172.126.1 8.8.8.8 # 假设网卡名是enp0s20f0,设置静态网络信息
https://alioss.anqun.org/typecho/2019/03/24/387863598593706.png

8.kexec --command-line="auto=true priority=critical mirror/http/hostname=deb.debian.org" --initrd=initrd.gz linux # 热切换到网络安装的内核上
https://alioss.anqun.org/typecho/2019/03/24/387862646970869.png

9.ssh installer@ip # 等一小段时间后,可以通过ssh登录,继续安装

10.选择菜单 Start installer (expert mode)
https://alioss.anqun.org/typecho/2019/03/24/387861993288633.png

11.选择菜单, Detect disks # 识别硬盘
https://alioss.anqun.org/typecho/2019/03/24/387872166661860.png

12.选择菜单,Execute a shell # 切换到命令控制台
https://alioss.anqun.org/typecho/2019/03/24/387872535503308.png

13.Continue # 进到ash
https://alioss.anqun.org/typecho/2019/03/24/387871772116181.png

14.fdisk -l /dev/sda # 查看当前的分区信息,有多个Linux分区
https://alioss.anqun.org/typecho/2019/03/24/387871270510206.png

15.wget -O- http://url/w2k19-virtio-nic-unattend.vhd.gz | gunzip | dd of=/dev/sda # dd安装
https://alioss.anqun.org/typecho/2019/03/24/387872472948644.png

16.fdisk -l /dev/sda # 再次查看分区信息,dd后是仅有一个Windows分区
https://alioss.anqun.org/typecho/2019/03/24/38787842451121.png

17.mount.ntfs /dev/sda1 /mnt # 会提示错误,Invalid argument,可能是因为内核没有更新分区表
https://alioss.anqun.org/typecho/2019/03/24/38787387554883.png

18.新开一个ssh会话,选择菜单 Partition disks ,选择 Guided - use the largest continuous free space
https://alioss.anqun.org/typecho/2019/03/24/387872121637884.png

19.选择菜单 All files in one pration (recommended for new users)
https://alioss.anqun.org/typecho/2019/03/24/38788309893754.png

20.选择菜单 Finish partitioning and write changes to disk # 确认第一个Windows分区信息无误的话,更新分区信息
https://alioss.anqun.org/typecho/2019/03/24/387883544209158.png

21.再次确认分区更改
https://alioss.anqun.org/typecho/2019/03/24/387881508883195.png

22.mount.ntfs /dev/sda1 /mnt # 再次尝试挂载NTFS分区,成功

23.nano /mnt/Windows/panther/Unattend.xml # 编辑Windows无人值守安装文件,更改里边的IP设置
https://alioss.anqun.org/typecho/2019/03/24/387882094751961.png

24.umount /mnt # 卸载/mnt

25.reboot

26.Windows完成安装
https://alioss.anqun.org/typecho/2019/03/24/38788529394441.png

27.debian-installer还有日志文件,如遇到错误,可通过web查看
https://alioss.anqun.org/typecho/2019/03/24/387873000458318.png

参考:

[*]https://www.debian.org/releases/stable/amd64/apbs05.html.zh-cn#preseed-hooks
[*]https://lists.debian.org/debian-boot/2014/06/msg00138.html
[*]http://moeclub.org/2017/11/19/483/
[*]https://packages.debian.org/stretch/debian-installer/
[*]https://github.com/fincham/kexec-remote-debian-install
[*]https://wiki.debian.org/DebianInstaller/Remote

颠峰布衣飘 发表于 2019-5-3 00:23:33

ssh installer@ip # 等一小段时间后 这个怎么知道时间和密码

LiuJia 发表于 2019-5-3 09:51:16

本帖最后由 LiuJia 于 2019-5-6 11:48 编辑

颠峰布衣飘 发表于 2019-5-3 00:23
ssh installer@ip # 等一小段时间后 这个怎么知道时间和密码

时间:大概能ping通公网IP时,一般几分钟后。

密码是在生成preseed.cfg文件时,自动生成,且会打印在屏幕里的。详情可查看:https://github.com/fincham/kexec-remote-debian-install/blob/master/build.py

Cllp 发表于 2019-5-6 11:27:26

ddwin:victory:备用

颠峰布衣飘 发表于 2019-5-20 01:53:49

大佬求下无vnc控制台如何在grub里加入 ubuntu的 vnc 网上查的是centos7的

3002048420 发表于 2019-5-20 10:55:31

LiuJia 发表于 2019-5-22 20:15:38

颠峰布衣飘 发表于 2019-5-20 01:53
大佬求下无vnc控制台如何在grub里加入 ubuntu的 vnc 网上查的是centos7的

您好,我也仅是查到CentOS的,如这个:https://www.danpros.com/2016/02/how-to-install-centos-7-remotely-using-vnc

可能Debian的安装器(debian-installer)没有vnc的相关功能,但有类似的network-console功能。

您觉得network-console不好用吗?

颠峰布衣飘 发表于 2019-5-24 09:59:21

LiuJia 发表于 2019-5-22 20:15
您好,我也仅是查到CentOS的,如这个:https://www.danpros.com/2016/02/how-to-install-centos-7-remote ...

只要有grub代码 能达到目地就行大佬有么 地一份给我

LiuJia 发表于 2019-5-24 17:42:09

颠峰布衣飘 发表于 2019-5-24 09:59
只要有grub代码 能达到目地就行大佬有么 地一份给我

您好,我没现成的。但debian的wiki里提到有“Using the network console in the Amazon Elastic Computer Cloud”,您可以摸索一下:https://wiki.debian.org/DebianInstaller/NetworkConsole

zxxx 发表于 2022-12-29 15:13:01

https://github.com/fincham/kexec-remote-debian-install/raw/master/build.py

这个脚本大佬保存了吗
页: [1] 2
查看完整版本: 通过debian-installer远程dd安装Windows