reinstall

reinstall

Codacy CodeFactor Lines of Code

One-Click system reinstallation script for VPS 中文

Introduction

If this helped you, you can buy me a milk tea. Donate

Sponsors

Feedback

GitHub Issues Telegram Group

Quick Start

System Requirements

The original system can be any system listed in the table.

The system requirements for the target system are as follows:

System Version Memory Disk
Alpine 3.20, 3.21, 3.22, 3.23 256 MB 1 GB
Debian 9, 10, 11, 12, 13 256 MB 1 ~ 1.5 GB ^
Kali Rolling 256 MB 1 ~ 1.5 GB ^
Ubuntu 16.04 LTS - 24.04 LTS, 25.10 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 42, 43 512 MB * 5 GB
openEuler 20.03 LTS - 24.03 LTS, 25.09 512 MB * 5 GB
openSUSE Leap 15.6, 16.0, Tumbleweed (Rolling) 512 MB * 5 GB
NixOS 25.11 512 MB 5 GB
Arch Rolling 512 MB 5 GB
Gentoo Rolling 512 MB 5 GB
AOSC OS Rolling 512 MB 5 GB
fnOS 1 512 MB 8 GB
Windows (DD) Any 512 MB Depends on image
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

* Indicates installation using cloud images, not traditional network installation.

^ Indicates requiring either 256 MB memory + 1.5 GB disk, or 512 MB memory + 1 GB disk

[!WARNING]

In theory it also supports dedicated servers and PCs

but if you can use IPMI or a USB drive, this script is not recommended.

[!WARNING]

❌ This script does not support OpenVZ or LXC virtual machines.

Please use https://github.com/LloydAsp/OsMutation instead.

Download (Current system is Linux)

For server outside China:

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

For server inside China:

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

Download (Current system is Windows)

[!IMPORTANT] Before proceeding, please disable the ‘Real-time protection’ feature in Windows Defender. This feature may prevent certutil from downloading any files.

Resolving Script Download Issues on Windows 7 Due to lack of support for TLS 1.2, SHA-256, or outdated root certificates, Windows Vista, 7, and Server 2008 (R2) may not be able to download scripts automatically. Manual downloading is required, as follows: Use Internet Explorer (enable TLS 1.2 in IE's advanced settings first) to download, or use Remote Desktop to save the following two files into the same directory: - <https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat> - <https://www.cygwin.com/setup-x86.exe> To use, run the downloaded `reinstall.bat`.

For server outside China:

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

For server inside China:

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

Usage

All features can be used on both Linux and Windows.

Feature 1: Install Linux

[!CAUTION]

This feature will erase the entire hard disk of the current system (including other partitions)!

Data is priceless — please think twice before proceeding!

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
                  nixos       25.11
                  fedora      42|43
                  debian      9|10|11|12|13
                  alpine      3.20|3.21|3.22|3.23
                  opensuse    15.6|16.0|tumbleweed
                  openeuler   20.03|22.03|24.03|25.09
                  ubuntu      16.04|18.04|20.04|22.04|24.04|25.10 [--minimal]
                  kali
                  arch
                  gentoo
                  aosc
                  redhat      --img="http://access.cdn.redhat.com/xxx.qcow2"

Optional Parameters

[!TIP]

Can monitor the progress through various methods (SSH, HTTP 80 port, VNC from server provider, serial console).

Even if errors occur during the installation process, SSH is available for manual recovery.

If the target system is not Debian/Kali, run /trans.sh alpine can automatically recover to Alpine Linux.

Experimental Features Install Debian using a cloud image - Suitable for machines with slower CPUs ```bash bash reinstall.sh debian --ci ``` Install CentOS, AlmaLinux, Rocky, Fedora using ISO - Only supports machines with more than 2G of memory and dynamic IP. - Password is `123@@@`, and the SSH port is `22`; modifying them using parameters is not supported. ```bash bash reinstall.sh centos --installer ``` Install Ubuntu using ISO - Only supports machines with more than 1G of memory and dynamic IP. - Password is `123@@@`, and the SSH port is `22`; modifying them using parameters is not supported. ```bash bash reinstall.sh ubuntu --installer ```

Feature 2: DD RAW image to hard disk

[!CAUTION]

This feature will erase the entire hard disk of the current system (including other partitions)!

Data is priceless — please think twice before proceeding!

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

Optional Parameters

[!TIP]

Can monitor the progress through various methods (SSH, HTTP 80 port, VNC from server provider, serial console).

Even if errors occur during the installation process, SSH is available for manual recovery.

Or Run /trans.sh alpine to automatically recover to Alpine Linux.

Feature 3: Reboot to Alpine Live OS

[!TIP]

Although the script being run is reinstall, this feature does not delete any data or perform an automatic reinstallation; manual user operation is required.

If the user does not damage the original system during manual operation, rebooting will return to the original system.

bash reinstall.sh alpine --hold 1

Optional Parameters

Feature 4: Reboot to netboot.xyz

[!TIP]

Although the script being run is reinstall, this feature does not delete any data or perform an automatic reinstallation; manual user operation is required.

If the user does not damage the original system during manual operation, rebooting will return to the original system.

bash reinstall.sh netboot.xyz

netboot.xyz

Feature 5: Install Windows ISO

Windows Installation

[!CAUTION]

This feature will erase the entire hard disk of the current system (including other partitions)!

Data is priceless — please think twice before proceeding!

Supported Systems

Method 1: Let the Script Automatically Search for ISO

bash reinstall.sh windows \
     --image-name "Windows 11 Enterprise LTSC 2024" \
     --lang zh-cn
Supported languages ```text ar-sa bg-bg cs-cz da-dk de-de el-gr en-gb en-us es-es es-mx et-ee fi-fi fr-ca fr-fr he-il hr-hr hu-hu it-it ja-jp ko-kr lt-lt lv-lv nb-no nl-nl pl-pl pt-pt pt-br ro-ro ru-ru sk-sk sl-si sr-latn-rs sv-se th-th tr-tr uk-ua zh-cn zh-hk zh-tw ```
bash reinstall.sh windows \
     --image-name "Windows 11 Enterprise LTSC 2024 Evaluation" \
     --iso "https://go.microsoft.com/fwlink/?linkid=2289029"

or Magnet Link

bash reinstall.sh windows \
     --image-name "Windows 11 Enterprise LTSC 2024" \
     --iso "magnet:?xt=urn:btih:7352bd2db48c3381dffa783763dc75aa4a6f1cff"
The following website provides ISO links. - General - <https://msdl.gravesoft.dev> - <https://massgrave.dev/genuine-installation-media> - <https://next.itellyou.cn> - <https://www.xitongku.com> - <https://www.microsoft.com/software-download/windows10> (Need to open it with a non-Windows User-Agent) - <https://www.microsoft.com/software-download/windows11> - <https://www.microsoft.com/software-download/windows11arm64> - Evaluation - <https://www.microsoft.com/evalcenter/download-windows-11-enterprise> - <https://www.microsoft.com/evalcenter/download-windows-11-iot-enterprise-ltsc-eval> - <https://www.microsoft.com/evalcenter/download-windows-server-2012-r2> - <https://www.microsoft.com/evalcenter/download-windows-server-2016> - <https://www.microsoft.com/evalcenter/download-windows-server-2019> - <https://www.microsoft.com/evalcenter/download-windows-server-2022> - <https://www.microsoft.com/evalcenter/download-windows-server-2025> - Insider Preview - <https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewiso> - <https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewserver>

Optional Parameters

The following drivers will automatic download and install as needed, without the need for manual addition

How to Specify the Image Name --image-name

An ISO usually contains multiple system editions, such as Home and Pro. Therefore, you need to use --image-name to specify the system edition (image name) to install, case-insensitive.

You can use tools like DISM, DISM++, or Wimlib to query the image names included in the ISO.

Commonly used image names include:

Windows 7 Ultimate
Windows 11 Pro
Windows 11 Enterprise LTSC 2024
Windows Server 2025 SERVERDATACENTER

How to Use DISM++ to Query the Image Names Included in the ISO

Open File menu > Open Image File, select the iso to be installed to get the image name (full system name), and all available image names are installable.

image-name

[!WARNING] Vista (Server 2008) and 32-bit systems may lack drivers.

[!WARNING]

For Windows 7 (Server 2008 R2) installation:

  1. EFI-boot machines must enable CSM.

  2. On Hyper-V (Azure), select Generation 1 VM. https://learn.microsoft.com/windows-server/virtualization/hyper-v/plan/should-i-create-a-generation-1-or-2-virtual-machine-in-hyper-v

[!WARNING]

In the Chinese version of Windows 10 LTSC 2021 ISO zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso, the wsappx process may indefinitely consume CPU resources.

The solution is to update the system patches or manually install the VCLibs library https://www.google.com/search?q=ltsc+wsappx.

[!WARNING]

When installing Windows ISOs released in May 2022 or later on GCP, the system may repeatedly reboot during the Windows installation (PE) stage. You can resolve this issue using one of the following two methods:

  1. Add the --force-boot-mode bios parameter. The script will install Windows in BIOS boot + MBR partition table mode.

    (Optional) After installation, you can convert it to EFI boot + GPT partition table using the command MBR2GPT /convert /allowFullOS.

  2. Create a custom RAW image and install it via DD.

Considerations for Installing Windows on ARM

Most ARM machines support installing latest Windows 11.

During the installation process, you might encounter a black screen, and the serial console may display ConvertPages: failed to find range, but neither issue affects the installation.

Compatibility Cloud Provider Instance Type Issues
✔️ Azure B2pts_v2  
✔️ Alibaba Cloud g6r, c6r  
✔️ Alibaba Cloud g8y, c8y, r8y There is a chance of hanging at the boot logo during restart; forced reboot will resolve it.
✔️ AWS T4g  
✔️ Scaleway COPARM1  
✔️ Gcore    
Oracle Cloud A1.Flex Installation success is not guaranteed; newer instances are more likely to succeed.
Manual loading of GPU drivers is required after installation.
Google Cloud t2a Missing network card drivers
Loading Graphics Driver on Oracle Cloud Log in to the server using Remote Desktop, open Device Manager, locate the graphics card, select "Update Driver," and choose `Red Hat VirtIO GPU DOD controller` from the list. There's no need to download the drivers in advance. ![virtio-gpu-1](https://github.com/user-attachments/assets/503e1d82-4fa9-4486-917e-73326ad7c988) ![virtio-gpu-2](https://github.com/user-attachments/assets/bf3a9af6-13d8-4f93-9d6c-d3b2dbddb37d) ![virtio-gpu-3](https://github.com/user-attachments/assets/a9006a78-838f-45bf-a556-2dba193d3c03)

Parameter Format

–ssh-key

How to Use an Old Version

According to the Law of Bug Conservation, fixing old bugs often introduces new ones.

If a new bug occurs, try using an older version to see if it works.

Go to https://github.com/bin456789/reinstall/commits/main and find the old version’s commit_id on the right side.

commit_id=xxxxxxx
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 ...

How to Modify the Script for Your Own

  1. Fork this repository.
  2. Modify the confhome and confhome_cn at the beginning of reinstall.sh and reinstall.bat.
  3. Make changes to the other code.

Thanks

Thanks to the following businesses for providing free servers.

Oracle Cloud DartNode