reinstall README

The project's README from github.com/bin456789/reinstall. As one markdown file: README.md.

reinstall

Codacy CodeFactor Lines of Code

bin456789%2Freinstall | Trendshift

一键 VPS 系统重装脚本 English

介绍

请我喝奶茶: Donate

Sponsors

反馈

GitHub Issues Telegram Group

快速开始

系统要求

原系统可以是表格中的任意系统

目标系统的配置要求如下:

系统 版本 内存 硬盘
Alpine 3.21, 3.22, 3.23, 3.24 256 MB 1 GB
Debian 9 ELTS - 11 ELTS, 12, 13 256 MB 1 ~ 1.5 GB ^
Kali Last-Snapshot, Rolling (滚动) 256 MB 1 ~ 1.5 GB ^
Ubuntu 18.04 LTS - 26.04 LTS 512 MB * 2 GB
Anolis 7, 8, 23 512 MB * 5 GB
RHEL   AlmaLinux   Rocky   Oracle 8, 9, 10 512 MB * 5 GB
OpenCloudOS 8, 9, Stream 23 512 MB * 5 GB
CentOS Stream 9, 10 512 MB * 5 GB
Fedora 43, 44 512 MB * 5 GB
openEuler 20.03 LTS - 24.03 LTS 512 MB * 5 GB
openSUSE Leap 16.0, Tumbleweed (滚动) 512 MB * 5 GB
NixOS 26.05 512 MB 5 GB
Arch Linux / Arch Linux ARM 滚动 512 MB 5 GB
Gentoo 滚动 512 MB 5 GB
安同 OS 滚动 512 MB 5 GB
飞牛 fnOS   FygoOS 1 512 MB 10 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]

本脚本理论上支持独服和 PC

但如果能使用 IPMI 或 U 盘,则不建议使用本脚本

[!WARNING]

❌ 本脚本不支持 OpenVZ、LXC 虚拟机

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

下载(当前系统是 Linux)

国外服务器:

curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O ${_##*/} $_

国内服务器:

curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh || wget -O ${_##*/} $_

下载(当前系统是 Windows)

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

解决 Windows 7 下无法下载脚本

由于不支持 TLS 1.2、SHA-256、根证书没有更新等原因,Vista,7 和 Server 2008 (R2) 可能无法自动下载脚本,因此需要手动下载,具体操作如下:

用 IE 下载 (先在 IE 高级设置里启用 TLS 1.2),或者通过远程桌面,将这两个文件保存到同一个目录

使用时运行下载的 reinstall.bat

国外服务器:

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

国内服务器:

certutil -urlcache -f -split https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.bat

使用

所有功能 都可在 Linux / Windows 下运行

功能 1: 安装 Linux

[!CAUTION]

此功能会清除当前系统整个硬盘的全部数据(包含其它分区)!

如果不小心运行了脚本,可以在重启前运行 bash reinstall.sh reset 取消重装

bash reinstall.sh anolis      7|8|23
                  rocky       8|9|10
                  oracle      8|9|10
                  almalinux   8|9|10
                  opencloudos 8|9|23
                  centos      9|10
                  fnos        1
                  fygoos      1
                  nixos       26.05
                  fedora      43|44
                  debian      9|10|11|12|13
                  opensuse    16.0|tumbleweed
                  openeuler   20.03|22.03|24.03
                  alpine      3.21|3.22|3.23|3.24
                  kali        last-snapshot|rolling
                  ubuntu      18.04|20.04|22.04|24.04|26.04 [--minimal]
                  arch
                  gentoo
                  aosc
                  redhat      --img="http://access.cdn.redhat.com/xxx.qcow2"

可选参数

[!TIP]

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

即使安装过程出错,也能连接 SSH 手动救砖。

目标系统非 Debian/Kali 时,可以运行 /trans.sh alpine 自动救砖成 Alpine 系统。

已弃用的功能

云镜像安装 Debian

  • 适合于 CPU 较慢的机器
bash reinstall.sh debian --ci

ISO 安装 CentOS, AlmaLinux, Rocky, Fedora

  • 仅支持内存大于 2G 且为动态 IP 的机器
  • 用户名 root,密码 123@@@,SSH 端口 22,不支持用参数修改
bash reinstall.sh centos --installer
bash reinstall.sh almalinux --installer
bash reinstall.sh rocky --installer
bash reinstall.sh fedora --installer

ISO 安装 Ubuntu

  • 仅支持内存大于 1G 且为动态 IP 的机器
  • 用户名 root,密码 123@@@,SSH 端口 22,不支持用参数修改
bash reinstall.sh ubuntu --installer

功能 2: DD RAW 镜像到硬盘

[!CAUTION]

此功能会清除当前系统整个硬盘的全部数据(包含其它分区)!

如果不小心运行了脚本,可以在重启前运行 bash reinstall.sh reset 取消重装

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

可选参数

[!TIP]

--cloud-data 参数为本地目录或 HTTP 基础 URL,目录须包含 user-data 文件,meta-data、network-config 可选:

seed/
├── user-data      # 必须
├── meta-data      # 可选
└── network-config # 可选
# 使用本地目录
bash reinstall.sh dd --img "https://example.com/xxx.xz" --cloud-data /path/to/seed/
# 使用 HTTP 目录
bash reinstall.sh dd --img "https://example.com/xxx.xz" --cloud-data "https://example.com/seed/"

[!TIP]

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

即使安装过程出错,也能连接 SSH 手动救砖

也可以运行 /trans.sh alpine 自动救砖成 Alpine 系统。

功能 3: 重启到 Alpine Live OS(内存系统)

[!TIP]

虽然运行的脚本叫 reinstall,但是此功能不会删除任何数据和进行自动重装,而是要用户手动操作

如果用户手动操作没有破坏原系统,再次重启将回到原系统

bash reinstall.sh alpine --hold 1

可选参数

功能 4: 重启到 netboot.xyz

[!TIP]

虽然运行的脚本叫 reinstall,但是此功能不会删除任何数据和进行自动重装,而是要用户手动操作

如果用户手动操作没有破坏原系统,再次重启将回到原系统

bash reinstall.sh netboot.xyz

netboot.xyz

功能 5: 安装 Windows ISO

Windows 安装界面

[!CAUTION]

此功能会清除当前系统整个硬盘的全部数据(包含其它分区)!

如果不小心运行了脚本,可以在重启前运行 bash reinstall.sh reset 取消重装

支持的系统

方法 1: 让脚本自动查找 ISO

bash reinstall.sh windows \
     --image-name "Windows 11 Enterprise LTSC 2024" \
     --lang zh-cn
--image-name 列表

以下版本支持自动查找,其它版本请用方法 2 手动指定 ISO 链接安装

Windows Vista Starter
Windows Vista HomeBasic
Windows Vista HomePremium
Windows Vista Business
Windows Vista Ultimate
Windows Vista Enterprise

Windows 7 Starter
Windows 7 HomeBasic
Windows 7 HomePremium
Windows 7 Professional
Windows 7 Ultimate
Windows 7 Enterprise

Windows 8
Windows 8 Pro
Windows 8 Enterprise

Windows 8.1
Windows 8.1 Pro
Windows 8.1 Enterprise

Windows 10 Home
Windows 10 Home Single Language
Windows 10 Pro
Windows 10 Pro Education
Windows 10 Pro for Workstations
Windows 10 Education
Windows 10 Enterprise
Windows 10 Enterprise 2015 LTSB
Windows 10 Enterprise 2016 LTSB
Windows 10 Enterprise LTSC 2019
Windows 10 Enterprise LTSC 2021
Windows 10 IoT Enterprise
Windows 10 IoT Enterprise 2015 LTSB
Windows 10 IoT Enterprise 2016 LTSB
Windows 10 IoT Enterprise LTSC 2019
Windows 10 IoT Enterprise LTSC 2021

Windows 11 Home
Windows 11 Home Single Language
Windows 11 Pro
Windows 11 Pro Education
Windows 11 Pro for Workstations
Windows 11 Education
Windows 11 Enterprise
Windows 11 Enterprise LTSC 2024
Windows 11 IoT Enterprise
Windows 11 IoT Enterprise LTSC 2024
Windows 11 IoT Enterprise Subscription
Windows 11 IoT Enterprise Subscription LTSC 2024

Windows Longhorn ServerWeb
Windows Longhorn ServerWebCore
Windows Longhorn ServerStandard
Windows Longhorn ServerStandardCore
Windows Longhorn ServerEnterprise
Windows Longhorn ServerEnterpriseCore
Windows Longhorn ServerDatacenter
Windows Longhorn ServerDatacenterCore

Windows Server 2008 R2 ServerWeb
Windows Server 2008 R2 ServerWebCore
Windows Server 2008 R2 ServerStandard
Windows Server 2008 R2 ServerStandardCore
Windows Server 2008 R2 ServerEnterprise
Windows Server 2008 R2 ServerEnterpriseCore
Windows Server 2008 R2 ServerDatacenter
Windows Server 2008 R2 ServerDatacenterCore

Windows Server 2012 ServerStandard
Windows Server 2012 ServerStandardCore
Windows Server 2012 ServerDatacenter
Windows Server 2012 ServerDatacenterCore

Windows Server 2012 R2 ServerStandard
Windows Server 2012 R2 ServerStandardCore
Windows Server 2012 R2 ServerDatacenter
Windows Server 2012 R2 ServerDatacenterCore

Windows Server 2016 ServerStandard
Windows Server 2016 ServerStandardCore
Windows Server 2016 ServerDatacenter
Windows Server 2016 ServerDatacenterCore

Windows Server 2019 ServerStandard
Windows Server 2019 ServerStandardCore
Windows Server 2019 ServerDatacenter
Windows Server 2019 ServerDatacenterCore

Windows Server 2022 ServerStandard
Windows Server 2022 ServerStandardCore
Windows Server 2022 ServerDatacenter
Windows Server 2022 ServerDatacenterCore

Windows Server 2025 ServerStandard
Windows Server 2025 ServerStandardCore
Windows Server 2025 ServerDatacenter
Windows Server 2025 ServerDatacenterCore
--lang 列表

支持这三种语言代码格式,不区分大小写

CC 格式 CC-CC 格式 语言
ar ar-sa Arabic
bg bg-bg Bulgarian
cs cs-cz Czech
da da-dk Danish
de de-de German
el el-gr Greek
gb en-gb Eng_Intl
en en-us English
es es-es Spanish
mx es-mx Spanish_Latam
et et-ee Estonian
fi fi-fi Finnish
fr-ca FrenchCanadian
fr fr-fr French
he he-il Hebrew
hr hr-hr Croatian
hu hu-hu Hungarian
it it-it Italian
ja ja-jp Japanese
ko ko-kr Korean
lt lt-lt Lithuanian
lv lv-lv Latvian
no nb-no Norwegian
nl nl-nl Dutch
pl pl-pl Polish
pp pt-pt Portuguese
pt pt-br Brazilian
ro ro-ro Romanian
ru ru-ru Russian
sk sk-sk Slovak
sl sl-si Slovenian
sr sr-latn / sr-latn-rs Serbian_Latin
sv sv-se Swedish
th th-th Thai
tr tr-tr Turkish
uk uk-ua Ukrainian
cn zh-cn ChnSimp
tw zh-tw ChnTrad
hk zh-hk ChnTrad_Hong_Kong

方法 2: 自行指定 ISO 连接

bash reinstall.sh windows \
     --image-name "Windows 11 Enterprise LTSC 2024 Evaluation" \
     --iso "https://go.microsoft.com/fwlink/?linkid=2289029"

或者磁力链接

bash reinstall.sh windows \
     --image-name "Windows 11 Enterprise LTSC 2024" \
     --iso "magnet:?xt=urn:btih:7352bd2db48c3381dffa783763dc75aa4a6f1cff"
以下网站可找到 ISO 链接

可选参数

以下驱动会自动按需下载安装,使用 --no-auto-drivers 可禁止此功能

如何填写映像名称 --image-name

一个 ISO 通常包含多个系统版本,例如家庭版、专业版。因此需要用 --image-name 指定要安装的系统版本(映像名称),不区分大小写

可以用 DISM、DISM++、Wimlib 等工具查询 ISO 包含的映像名称

如何用 DISM++ 查询 ISO 包含的映像名称

打开文件菜单 > 打开映像文件,选择要安装的 iso,即可得到映像名称,所有映像名称都可以安装

image-name

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

[!WARNING]

安装 Vista、7、Server 2008、Server 2008 R2 时

  1. EFI 引导的机器要开启 CSM

  2. Hyper-V / Azure 需选择第 1 代虚拟机

[!WARNING]

Windows 10 LTSC 2021 中文版镜像 zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso 的 wsappx 进程会长期占用 CPU

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

[!WARNING]

在 GCP 上安装 2022年5月 和之后发布的 Windows ISO,在引导 Windows 安装界面 (PE) 时会不断反复重启。解决方法如下,二选一

  1. 添加 --force-boot-mode bios 参数,脚本将以 BIOS 引导 + MBR 分区表 方式安装 Windows

    (可选) 安装完成后用 MBR2GPT /convert /allowFullOS 命令转为 EFI 引导 + GPT 分区表

  2. 自制 RAW 镜像并通过 DD 安装

ARM 安装 Windows 的注意事项

大部分 ARM 云服务器支持安装 Windows 11

安装过程可能会黑屏,串行控制台可能会显示 ConvertPages: failed to find range,均不影响正常安装

兼容性 云服务商 实例类型 问题
✔️ Azure B2pts_v2
✔️ AWS T4g
✔️ Scaleway COPARM1
✔️ Gcore
❔ 阿里云 g6r, c6r, g8y, c8y, r8y 有几率重启时卡开机 Logo,强制重启即可
❔ 甲骨文云 A1.Flex 不一定能安装成功,越新创建的实例越容易成功
❌ 谷歌云 t2a 缺少网卡驱动

取消重装

bash reinstall.sh reset

参数格式

--ssh-key

如何使用旧版本

根据 Bug 守恒定律,修复旧 Bug 的同时会引入新的 Bug

如果脚本出现问题,可以试下旧版本是否正常

从 https://github.com/bin456789/reinstall/commits/main 右侧找到旧版本的 commit_id

将下面脚本的 xxxxxxxx 替换成旧版本的 commit_id 并运行脚本

commit_id=xxxxxxxx
curl -O https://raw.githubusercontent.com/bin456789/reinstall/$commit_id/reinstall.sh || wget -O ${_##*/} $_
sed -i "/^confhome.*main$/s/main/$commit_id/" reinstall.sh
bash reinstall.sh ...

如何修改脚本自用

  1. Fork 本仓库
  2. 修改 reinstall.sh 和 reinstall.bat 开头的 confhome 和 confhome_cn
  3. 修改其它代码
  4. 下载并运行你的 reinstall.sh 或 reinstall.bat

感谢

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

Oracle Cloud DartNode

reinstall (bin456789/reinstall)

Searching Database…

13.8K ·GitHub
What is this?A one-click script that reinstalls a VPS's operating system over the network: about 20 common Linux distros, or Windows from official ISOs — and the machine can currently be running either Linux or Windows.
Is this something I run on the server itself, or a panel I use from my laptop?It runs on the very machine you want to wipe: bash reinstall.sh ... on Linux, or reinstall.bat ... in cmd on Windows. It reboots that server into a small installer environment and pulls everything from official mirrors on the fly — no custom images.
How do I kick off a reinstall?Run the script with the target system, e.g. bash reinstall.sh debian 12 (reinstall.bat ... on Windows); it asks for a username and password — root with a random password if you skip — then reboots into the installer. Ran it by mistake? bash reinstall.sh reset before the reboot cancels it.
What does the server need for this to work?Any current system from its support table, booting via BIOS or EFI — ARM servers work too. Targets can be tiny: 256 MB RAM and 1 GB disk for Alpine or Debian, 512 MB for most distros, and 1 GB RAM plus 25 GB disk for a Windows 10/11 ISO.
What should I know before running it — is it risky?Yes: an install wipes the entire disk including other partitions. OpenVZ and LXC containers are not supported, and on dedicated servers or a PC the author suggests preferring IPMI or a USB stick when available.
Can it really put Windows on a cheap VPS?Yes — official ISOs from Windows Vista through 11 and Server 2008 through 2025, in any language. The script can find ISO links for you, auto-installs the right cloud drivers (VirtIO, AWS ENA, GCP gVNIC, Azure MANA, Intel VMD), configures static IPs and even bypasses Windows 11 hardware checks.
My VPS has an unusual network setup — will it cope?It auto-detects static vs dynamic IP and handles the odd cases: /32 and /128 addresses, a gateway outside the subnet, IPv6-only machines, and IPv4 and IPv6 living on different NICs.
What are the Alpine Live OS and netboot.xyz modes for?Alpine mode reboots into a small in-memory system you SSH into for backups, manual DD, partition edits or a manual Alpine install — it deletes nothing on its own, so a plain reboot brings the old system back. netboot.xyz likewise just boots its menu for manual installs via the provider's VNC.
How do I follow the install or rescue a failed one?Over SSH, HTTP on port 80, the provider's VNC or a serial console. A failed install is not the end: you can still SSH in, and running /trans.sh alpine rescues the machine into an Alpine system.
Creator
bin456789
Size
1.8 MB
Stars
13.8K
Updated
CommitOct 04
Age
4y
Commits · 90 Days