bin456789 / reinstall

一键DD/重装脚本 (One-click reinstall OS on VPS)
GNU General Public License v3.0
1.24k stars 218 forks source link
boot distro grub linux netboot netinst netinstall operating-systems os reinstall vps windows

reinstall

Codacy CodeFactor Lines of Code

一键重装脚本 English

亮点

配置要求

目标系统 版本 内存 硬盘
Alpine 3.17, 3.18, 3.19, 3.20 256 MB 1 GB
Debian 10, 11, 12 256 MB 1 ~ 1.5 GB ^
Kali 滚动 256 MB 1 ~ 1.5 GB ^
Ubuntu 20.04, 22.04, 24.04 512 MB * 2 GB
CentOS 7, 9 (stream) 512 MB * 5 GB
Oracle 7, 8, 9 512 MB * 5 GB
Alma 8, 9 512 MB * 5 GB
Rocky 8, 9 512 MB * 5 GB
Fedora 39, 40 512 MB * 5 GB
openSUSE 15.5, 15.6, Tumbleweed (滚动) 512 MB * 5 GB
Arch 滚动 512 MB 5 GB
Gentoo 滚动 512 MB 5 GB
Windows (DD) 任何 512 MB 取决于镜像
Windows (ISO) Vista, 7, 8.x (Server 2008 ~ 2012 R2) 512 MB 25 GB
Windows (ISO) 10, 11 (Server 2016 ~ 2025) 1 GB 25 GB

(*) 表示使用云镜像安装,非传统网络安装

(^) 需要 256 MB 内存 + 1.5 GB 硬盘,或 512 MB 内存 + 1 GB 硬盘

[!WARNING] ❌ 本脚本不支持 OpenVZ、LXC 虚拟机

请改用 https://github.com/LloydAsp/OsMutation

系统账号

系统 用户名 密码
Linux root 123@@@
Windows (ISO) administrator 123@@@
Windows (DD) 镜像用户名 镜像密码

[!TIP] 如果远程登录 Windows 失败,尝试使用用户名 .\administrator

下载(当前系统是 Linux)

国外服务器:

curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh

国内服务器:

curl -O https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh

下载(当前系统是 Windows)

[!IMPORTANT] 请先关闭 Windows Defender实时保护 功能。该功能会阻止 certutil 下载任何文件。

😢还是无法下载? ### 可尝试以下几种方法 1. Windows 7 安装此补丁启用 TLS 1.2 2. 更新 SSL 根证书 ```batch certutil -generateSSTFromWU root.sst certutil -addstore Root root.sst ``` 3. 手动下载,通过 `远程桌面` 复制这两个文件

国外服务器:

certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat

国内服务器:

certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat

使用

[!TIP] 所有功能均可在 Linux / Windows 下使用。

Linux 下运行 bash reinstall.sh

Windows 下运行 reinstall.bat

功能 1: 安装 Linux

[!TIP] 安装 Debian / Kali 时,x86 可通过后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。

安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。

bash reinstall.sh centos   7|9  (9 为 stream 版本)
                  oracle   7|8|9
                  alma     8|9
                  rocky    8|9
                  fedora   39|40
                  debian   10|11|12
                  ubuntu   20.04|22.04|24.04
                  alpine   3.17|3.18|3.19|3.20
                  opensuse 15.5|15.6|tumbleweed
                  kali
                  arch
                  gentoo

功能 2: DD

[!TIP] 可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。

bash reinstall.sh dd --img https://example.com/xxx.xz

功能 3: 重启到 Alpine 救援系统 (Live OS)

bash reinstall.sh alpine --hold=1

功能 4: 重启到 netboot.xyz

bash reinstall.sh netboot.xyz

netboot.xyz

功能 5: 安装 Windows ISO

[!TIP] 脚本以 https://massgrave.dev/genuine-installation-media.html 作为 iso 镜像查找源。所有 iso 都是官方原版。

[!IMPORTANT] 注意参数两边有引号。

bash reinstall.sh windows \
     --image-name 'Windows 10 Enterprise LTSC 2021' \
     --lang zh-cn
bash reinstall.sh windows \
     --image-name 'Windows 10 Enterprise LTSC 2021' \
     --iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso'
以下网站可找到 iso 链接 - Massgrave - (推荐,iso 来自官方,每月更新,包含最新补丁) - 微软 - - (需用手机 User-Agent 打开) - - (预览版) - - - - - - - -

Installing Windows

参数说明

--image-name 指定要安装的映像,不区分大小写,常用映像有:

Windows 7 Ultimate
Windows 10 Enterprise LTSC 2021
Windows 11 Pro
Windows Server 2022 SERVERDATACENTER

使用 Dism++ 文件菜单 > 打开映像文件,选择要安装的 iso,可以得到映像名称

image-name

支持的系统

* 需填写 iso 链接

脚本会按需安装以下驱动

[!WARNING] Vista (Server 2008) 和 32 位系统可能会缺少驱动

[!WARNING] 未开启 CSM 的 EFI 机器,无法安装 Windows 7 (Server 2008 R2)

[!WARNING] 支持 ARM 机器安装 Windows 11,仅限于 Hyper-V (Azure) ,不支持 KVM (甲骨文云)

[!WARNING] Windows 10 LTSC 2021 中文版镜像 zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.isowsappx 进程会长期占用 CPU

解决方法是更新系统补丁,或者手动安装 VCLibshttps://www.google.com/search?q=ltsc+wsappx

感谢

感谢以下商家提供白嫖机器

Oracle Cloud DartNode