# reinstall
[](https://app.codacy.com/gh/bin456789/reinstall/dashboard)
[](https://www.codefactor.io/repository/github/bin456789/reinstall)
[](https://github.com/XAMPPRocky/tokei)
[](https://t.me/reinstall_os)
[](https://github.com/sponsors/bin456789)
One-Click Script to Reinstall System [中文](README.md)

## Highlights
- One-click Linux installation: Supports 17 common distributions.
- One-click Windows installation: Uses the official ISO for installation instead of custom images. The script automatically retrieves the ISO link and installs `Virtio` and other 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 Server
- No homemades image included, all resources are obtained in real-time from mirror sites
- Includes many comments.
## System Requirements
The original system can be any system listed in the table.
The system requirements for the target system are as follows:
| Target System | Version | Memory | Disk |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | -----------------|
|
Alpine | 3.18, 3.19, 3.20, 3.21 | 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 LTS - 24.04 LTS, 24.10 | 512 MB \* | 2 GB |
|
Anolis | 7, 8, 23 | 512 MB \* | 5 GB |
|
RHEL
AlmaLinux
Rocky
Oracle | 8, 9 | 512 MB \* | 5 GB |
|
OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB |
|
CentOS | 9, 10 | 512 MB \* | 5 GB |
|
Fedora | 40, 41 | 512 MB \* | 5 GB |
|
openEuler | 20.03 LTS - 24.03 LTS, 24.09 | 512 MB \* | 5 GB |
|
openSUSE | 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB |
|
NixOS | 24.11 | 512 MB | 5 GB |
|
Arch | Rolling | 512 MB | 5 GB |
|
Gentoo | Rolling | 512 MB | 5 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]
> ❌ This script does not support OpenVZ or LXC virtual machines.
>
> Please use instead.
## Download (Current system is
Linux)
For server outside China:
```bash
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_
```
For server inside China:
```bash
curl -O https://gitlab.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 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:
-
-
To use, run the downloaded `reinstall.bat`.
For server outside China:
```batch
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
```
For server inside China:
```batch
certutil -urlcache -f -split https://gitlab.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
- The username is `root` with a default password of `123@@@`.
- When installing the latest version, the version number does not need to be specified.
- Maximizes disk space usage: no boot partition (except for Fedora) and no swap partition.
- Automatically selects different optimized kernels based on machine type, such as `Cloud` or `HWE` kernels.
- When installing Red Hat, you must provide the `qcow2` image link obtained from . You can also install other RHEL-based OS, such as `Alibaba Cloud Linux` and `TencentOS Server`.
- After reinstallation, if you need to change the SSH port or switch to key-based login, make sure to also modify the files inside `/etc/ssh/sshd_config.d/`.
```bash
bash reinstall.sh anolis 7|8|23
opencloudos 8|9|23
rocky 8|9
redhat 8|9 --img='http://xxx.com/xxx.qcow2'
oracle 8|9
almalinux 8|9
centos 9|10
fedora 40|41
nixos 24.11
debian 9|10|11|12
opensuse 15.6|tumbleweed
alpine 3.18|3.19|3.20|3.21
openeuler 20.03|22.03|24.03|24.09
ubuntu 16.04|18.04|20.04|22.04|24.04|24.10 [--minimal]
kali
arch
gentoo
```
#### Optional Parameters
- `--password PASSWORD` Set the password
- `--ssh-port PORT` Change the SSH port (for log observation during installation and for the new system)
- `--web-port PORT` Change the Web port (for log observation during installation)
- `--hold 2` Prevent reboot after installation completes, allowing SSH login to modify system content; the system is mounted at `/os` (this feature is not supported on Debian/Kali).
> [!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 to Alpine via SSH by running `/trans.sh alpine`
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
- Supports `raw` and `vhd` image formats (either uncompressed or compressed as `.gz`, `.xz`, `.zst`, `.tar`, `.tar.gz`, `.tar.xz`, `.tar.zst`).
- When deploy a Windows image, the system disk will be automatically expanded, and machines with a static IP will have their IP configured, and may take a few minutes after the first boot for the configuration to take effect.
- When deploy a Linux image, will **NOT** modify any contents of the image.
```bash
bash reinstall.sh dd --img https://example.com/xxx.xz
```
#### Optional parameters
- `--allow-ping` Allow ping responses (DD Windows only)
- `--rdp-port PORT` Change RDP port (DD Windows only)
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--hold 2` Prevent reboot after the DD process finishes, allowing SSH login to modify system content. The Windows system will be mounted at `/os`, but Linux systems will **NOT** be automatically mounted.
> [!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 to Alpine via SSH by running `/trans.sh alpine`
### Feature 3: Reboot to
Alpine Live OS (RAM OS)
- You can use SSH to backup/restore disk, manually perform DD operations, modify partitions, and manually install Alpine, Arch, Gentoo, and other systems.
- Username `root`, Default password `123@@@`
- If manual operations do not damage the original system, rebooting will return to the original system.
```bash
bash reinstall.sh alpine --hold=1
```
#### Optional parameters
- `--password PASSWORD` Set password
- `--ssh-port PORT` Change SSH port
### Feature 4: Reboot to
netboot.xyz
- Can manually install [more systems](https://github.com/netbootxyz/netboot.xyz?tab=readme-ov-file#what-operating-systems-are-currently-available-on-netbootxyz) using vendor backend VNC.
- If manual operations do not damage the original system, rebooting will return to the original system.
```bash
bash reinstall.sh netboot.xyz
```

### Feature 5: Install
Windows ISO

- Username `administrator`, Default password `123@@@`
- 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.
- Supports all languages.
#### Supported Systems
- Windows (Vista ~ 11)
- Windows Server (2008 ~ 2025)
- Windows Server Essentials \*
- Windows Server (Semi) Annual Channel \*
- Hyper-V Server \*
- Azure Stack HCI \*
#### ~~Method 1: Let the Script Automatically Search for ISO~~
> [!CAUTION]
> The ISO repository currently prohibits direct link downloads, so this method is no longer effective.
- The script will search for ISOs from , a site that collects official ISOs.
- Systems marked with \* do not support automatic ISO searching.
```bash
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
```
#### 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
bash reinstall.sh windows \
--image-name 'Windows 11 Enterprise LTSC 2024' \
--iso 'https://go.microsoft.com/fwlink/?linkid=2289029'
```
The following website provides ISO links.
- General
-
-
- (Need to open it with a non-Windows User-Agent)
-
-
- Evaluation
-
-
-
-
-
-
-
-
- Insider Preview
-
-
#### Optional parameters
- `--password PASSWORD` Set Password
- `--allow-ping` Configures the Windows firewall to allow ping requests
- `--rdp-port PORT` Change RDP port
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--add-driver-dir DIR` Adds an additional driver folder, specifying the folder where the .inf file is located.
- The driver must be downloaded locally first.
- This parameter can be set multiple times to add different driver folders.
- The script will copy the entire folder, so no other files should be placed inside the folder.
- `--hold 2` Allow SSH connections for modifying the disk content before rebooting into the official Windows installation program, with the disk mounted at `/os`.
#### The script will automatic download and install the following drivers as needed, without the need for manual addition
- Virtio ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/), [Alibaba Cloud](https://www.alibabacloud.com/help/ecs/user-guide/update-red-hat-virtio-drivers-of-windows-instances))
- XEN ([XEN](https://xenproject.org/resources/downloads/), [Citrix](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade), [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/xen-drivers-overview.html))
- AWS ([ENA Network Adapter](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ena-driver-releases-windows.html), [NVMe Storage Controller](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-driver-version-history.html))
- GCP ([gVNIC Network Adapter](https://cloud.google.com/compute/docs/networking/using-gvnic), [GGA Display Adapter](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display))
- Azure ([MANA Network Adapter](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows))
- Intel ([VMD Storage Controller](https://www.intel.com/content/www/us/en/download/720755/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-11th-up-to-13th-gen-platforms.html))
#### How to Specify the Image Name `--image-name`
Typically, an ISO will contain multiple system versions, such as Home Edition and Professional Edition. The image name `--image-name` is used to specify the version to be installed, and it is case-insensitive when entered.
You can use tools like DISM, DISM++, or Wimlib to query the image names included in the ISO.
Commonly used image names include:
```text
Windows 7 Ultimate
Windows 11 Pro
Windows 11 Enterprise LTSC 2024
Windows Server 2025 SERVERDATACENTER
```
#### How to Use [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) 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.

> [!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:
> [!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 .
#### Considerations for Installing Windows on ARM
Most ARM machines support installing Windows 11 24H2.
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.



## Discussion
[](https://github.com/bin456789/reinstall/issues)
[](https://t.me/reinstall_os)
## 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
[](https://github.com/sponsors/bin456789)
Thanks to the following businesses for providing free servers.
[](https://www.oracle.com/cloud/)
[](https://dartnode.com/)