23 KiB
reinstall
One-Click Script to Reinstall System 中文
Highlights
- Supports installation of 17 common Linux distributions
- Supports installation of official Windows ISO, automatically finds ISO links, and integrates virtual machine drivers
- Supports installation in any direction, i.e.,
Linux to Linux
,Linux to Windows
,Windows to Windows
,Windows to Linux
- No need to input IP parameters; automatically recognizes dynamic and static IPs, supports
/32
,/128
,gateway outside subnet
,IPv6 only
,dual NIC
and other special network configurations - Specially optimized for low-spec servers, requires less memory than the official netboot
- Uses partition table ID to identify hard drives throughout the process, ensuring no wrong disk is written
- Supports BIOS and EFI boot, and ARM architecture
- No homemades image included, all resources are obtained in real-time from source sites
- Includes many comments.
System Requirements
Target System | Version | Memory | Disk |
---|---|---|---|
Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB |
Debian | 9, 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ |
Ubuntu | 16.04, 18.04, 20.04, 22.04, 24.04 | 512 MB * | 2 GB |
CentOS | 9 | 512 MB * | 5 GB |
Anolis | 7, 8 | 512 MB * | 5 GB |
RedHat Alma Rocky | 8, 9 | 512 MB * | 5 GB |
OpenCloudOS | 8, 9 | 512 MB * | 5 GB |
Oracle | 7, 8, 9 | 512 MB * | 5 GB |
Fedora | 39, 40 | 512 MB * | 5 GB |
openEuler | 20.03, 22.03, 24.03 | 512 MB * | 5 GB |
openSUSE | 15.5, 15.6, Tumbleweed (Rolling) | 512 MB * | 5 GB |
NixOS | 24.05 | 512 MB | 5 GB |
Arch | Rolling | 512 MB | 5 GB |
Gentoo | Rolling | 512 MB | 5 GB |
Windows (DD) | Any | 512 MB | Depending on the 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
❌ 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 reinstall.sh $_
For server inside China:
curl -O https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh || wget -O reinstall.sh $_
Download (Current system is Windows)
Important
Before proceeding, please disable the 'Real-time protection' feature in
Windows Defender
. This feature may preventcertutil
from downloading any files.
😢Still unable to download?
Try the following methods
-
For Windows 7, install this patch to enable TLS 1.2.
-
Update SSL root certificates.
certutil -generateSSTFromWU root.sst certutil -addstore Root root.sst
-
Download manually by copying these two files through
Remote Desktop Connection
.https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
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://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.bat
Usage
All features can be used on both Linux and Windows.
- on Linux, execute
bash reinstall.sh
- on Windows, execute
reinstall.bat
Feature 1: Install Linux
- If no version number is entered, the latest version will be installed.
- Does not include a boot partition (except for Fedora), nor a swap partition, maximizing disk space utilization.
- On virtual machines, the appropriate official slimmed-down kernel will be automatically installed.
- To install Red Hat, you need to provide the
qcow2
image link obtained from https://access.redhat.com/downloads/content/rhel. - Username
root
, password123@@@
. It may take a few minutes for the password to take effect on the first boot. - After reinstalling, if you need to change SSH port or switch to key-based login, be sure to modify the files inside
/etc/ssh/sshd_config.d/
. - Optional parameters:
--ssh-port PORT
to change the SSH port--hold 2
to prevent entering the system after installation. You can connect via SSH to modify system content, with the system mounted at/os
(this feature is not supported on Debian/Kali).
bash reinstall.sh centos 9
anolis 7|8
alma 8|9
rocky 8|9
redhat 8|9 --img='http://xxx.com/xxx.qcow2'
opencloudos 8|9
oracle 7|8|9
fedora 39|40
nixos 24.05
debian 9|10|11|12
openeuler 20.03|22.03|24.03
alpine 3.17|3.18|3.19|3.20
opensuse 15.5|15.6|tumbleweed
ubuntu 16.04|18.04|20.04|22.04|24.04 [--minimal]
kali
arch
gentoo
Tip
When installing Debian / Kali, x86 architectures can monitor the installation progress through VNC in the background, while ARM architectures can use the serial console.
When installing other systems, can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console). Even if errors occur during the installation process, you can still install Alpine via SSH by running
xda=drive_name /trans.sh alpine
Experimental Features
The following features are experimental and may not support modifying the SSH port or other options.
Install Debian using a cloud image, suitable for machines with slower CPUs
bash reinstall.sh debian --ci
Install CentOS, Alma, Rocky, Fedora using ISO, only supports machines with more than 2G of memory and dynamic IP
bash reinstall.sh centos --installer
Install Ubuntu using ISO, only supports machines with more than 1G of memory and dynamic IP
bash reinstall.sh ubuntu --installer
Feature 2: DD
- Supports
raw
,vhd
images or those compressed withxz
orgzip
. - When deploy a Windows image, the system disk will be expanded, and machines with static IPs will have their IPs configured. However, it may take a few minutes after the first boot for the configuration to take effect.
- When deploy a Linux image, the script will not modify any contents of the image.
- Optional parameters:
--rdp-port PORT
to change the RDP port (Windows only).--allow-ping
to allow ping responses (Windows only).--hold 2
to prevent entering the system after DD completion. You can connect via SSH to modify system content, with the system mounted at/os
.
bash reinstall.sh dd --img https://example.com/xxx.xz
Tip
Can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console). Even if errors occur during the installation process, you can still install Alpine via SSH by running
xda=drive_name /trans.sh alpine
Feature 3: Reboot to Alpine Rescue System (Live OS)
- You can use SSH to manually perform DD operations, modify partitions, and manually install Alpine, Arch, Gentoo, and other systems.
- Username
root
, password123@@@
- If the disk content is not modified, rebooting again will return to the original system.
bash reinstall.sh alpine --hold=1
Feature 4: Reboot to netboot.xyz
- Can install more systems using vendor backend VNC.
- If the disk content is not modified, rebooting again will return to the original system.
bash reinstall.sh netboot.xyz
Feature 5: Install Windows ISO
- Username
administrator
, password123@@@
- If remote login fails, try using the username
.\administrator
. - The machine with a static IP will automatically configure the IP. It may take a few minutes to take effect on the first boot.
- Optional parameters:
--rdp-port PORT
to change the RDP port--allow-ping
to allow ping responses--hold 2
to allow SSH connections for modifying the hard disk content before rebooting into the official Windows installation program, with the hard disk mounted at/os
.
Method 1: Allow the script to automatically find the ISO
- The script will search for ISO files from https://massgrave.dev/genuine-installation-media.html. The ISOs provided on this site are all official versions.
- Only supports automatic detection of standard Windows and Windows Server versions.
bash reinstall.sh windows \
--image-name 'Windows 11 Enterprise LTSC 2024' \
--lang zh-cn
Supported languages
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
Method 2: Specify the ISO link manually
- If you don’t know the
--image-name
, you can enter any value. After rebooting, connect via SSH and re-enter the correct value based on the error messages.
bash reinstall.sh windows \
--image-name 'Windows 11 Enterprise LTSC 2024' \
--iso 'https://drive.massgrave.dev/zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso'
Important
Note that parameters should be enclosed in quotation marks.
The following website provides iso links.
- https://massgrave.dev/genuine-installation-media.html (Recommended, iso sourced from official channels, updated monthly, includes the latest patches)
- 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/windowsinsiderpreviewiso (Preview)
- https://www.microsoft.com/evalcenter/download-windows-10-enterprise
- https://www.microsoft.com/evalcenter/download-windows-11-enterprise
- https://www.microsoft.com/evalcenter/download-windows-11-iot-enterprise-ltsc
- 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
Parameters Description
--image-name
Specify the image to install, case-insensitive, Commonly used images include:
Windows 7 Ultimate
Windows 11 Pro
Windows 11 Enterprise LTSC 2024
Windows Server 2025 SERVERDATACENTER
Open DISM++ 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.
Supported systems
- Windows (Vista ~ 11)
- Windows Server (2008 ~ 2025)
- Windows Server Essentials *
- Windows Server (Semi) Annual Channel *
- Hyper-V Server *
- Azure Stack HCI *
With * indicating that an ISO link is required.
The script will install the following drivers as needed
- KVM (Virtio, Alibaba Cloud)
- XEN (XEN, Citrix, AWS)
- AWS (ENA Network Adapter, NVMe Storage Controller)
- GCP (gVNIC Network Adapter, GGA Graphics)
- Azure (MANA Network Adapter)
Warning
Vista (Server 2008) and 32-bit systems may lack drivers.
Warning
For EFI machines without CSM enabled, Windows 7 (Server 2008 R2) cannot be installed.
Hyper-V (Azure) requires selecting the appropriate VM generation: 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
, thewsappx
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.
ARM Considerations
Most ARM machines support ISO installation of Windows 11 24H2, but some machines may experience a black screen during installation, which does not affect the installation process.
- ✔️Azure: B2pts_v2
- ✔️Alibaba Cloud: g8y, c8y, r8y (may occasionally get stuck on the boot logo during restart; force restart to resolve)
- ✔️Alibaba Cloud: g6r, c6r
- ✔️Oracle Cloud A1.Flex (Success depends on the machine's creation date; newer instances are more likely to install successfully. You will also need to manually load the GPU drivers after installation.)
- ✔️AWS: T4g
- ✔️Scaleway: COPARM1
- ✔️Gcore
- ❌Google Cloud: t2a (lacking network card driver)
Loading Graphics Driver on Oracle Cloud
No need to download the driver, just open Device Manager, find the graphics card, select 'Update driver', and choose Red Hat VirtIO GPU DOD controller
from the list.
Discussion
How to Modify the Script
- Fork this repository.
- Modify the
confhome
andconfhome_cn
at the beginning ofreinstall.sh
andreinstall.bat
. - Make changes to the other code.
Thanks
Thanks to the following businesses for providing free servers.