Table of contents
Open Table of contents
Introduction
reinstall.sh is one of the most feature-rich one-click reinstallation scripts in the community. It can reinstall VPS instances or physical servers with multiple Linux distributions, and also supports Windows installation, writing raw disk images, booting into Alpine Live OS or netboot.xyz, and other advanced uses. This article focuses on the most common scenario: reinstalling a clean Linux system with a single command.
Project: https://github.com/bin456789/reinstall
1. Why reinstall the system first?
System images supplied by hosting providers may contain preinstalled software, while their default settings and software versions may not suit your needs. Before deploying services, reinstalling a system with a clear configuration can reduce differences between environments and make subsequent installation and maintenance easier.
2. Why choose this script?
Compared with similar scripts such as debi.sh, reinstall.sh has several notable advantages:
- Supports multiple Linux distributions, not just Debian.
- Configures IP addresses automatically, intelligently handles static and dynamic networking, and supports complex setups such as /32 and /128 addresses, gateways outside the subnet, and IPv6-only networks.
- Specifically adapted for low-spec VPS instances: Debian and Alpine require as little as 256 MB of memory.
- Automatically selects optimized kernels, such as Cloud or HWE kernels, according to the machine type.
- Uses partition table IDs throughout to identify disks and ensure it does not write to the wrong disk.
- Supports BIOS and EFI boot, as well as ARM servers.
3. System requirements
The existing operating system can be any of those in the table.
The requirements for the target system are as follows:
| System | Version | Memory | Disk |
|---|---|---|---|
| 3.21, 3.22, 3.23, 3.24 | 256 MB | 1 GB | |
| 9 ELTS - 11 ELTS, 12, 13 | 256 MB | 1 ~ 1.5 GB ^ | |
| Last-Snapshot, Rolling | 256 MB | 1 ~ 1.5 GB ^ | |
| 18.04 LTS - 26.04 LTS | 512 MB * | 2 GB | |
| 7, 8, 23 | 512 MB * | 5 GB | |
| 8, 9, 10 | 512 MB * | 5 GB | |
| 8, 9, Stream 23 | 512 MB * | 5 GB | |
| 9, 10 | 512 MB * | 5 GB | |
| 43, 44 | 512 MB * | 5 GB | |
| 20.03 LTS - 24.03 LTS | 512 MB * | 5 GB | |
| Leap 16.0, Tumbleweed (rolling) | 512 MB * | 5 GB | |
| 26.05 | 512 MB | 5 GB | |
| Rolling | 512 MB | 5 GB | |
| Rolling | 512 MB | 5 GB | |
| Any | 512 MB | Depends on the image | |
| Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB | |
| 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB |
* Indicates installation using a cloud image rather than a traditional network installation.
^ Requires either 256 MB of memory + 1.5 GB of disk space, or 512 MB of memory + 1 GB of disk space.
The script theoretically supports dedicated servers and PCs.
However, if IPMI or a USB drive is available, using this script is not recommended.
❌ This script does not support OpenVZ or LXC virtual machines.
Use https://github.com/LloydAsp/OsMutation instead.
Source: Project README, checked on 2026-09-13. Refer to the project README for the latest supported configurations.
4. Download the script
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
5. Reinstall Linux with one command
This operation erases all data on the entire disk, including other partitions! If you run it accidentally, you can cancel the reinstallation by running bash reinstall.sh reset before rebooting.
Basic usage (install Debian 13):
bash reinstall.sh debian 13
The script prompts for a username and password. If you leave them blank, it uses root and a random password. To install the latest version, omit the version number, for example bash reinstall.sh debian.
Examples for other distributions:
bash reinstall.sh alpine 3.23
bash reinstall.sh ubuntu 24.04
bash reinstall.sh rocky 10
bash reinstall.sh centos 10
bash reinstall.sh arch
Common optional parameters
| Parameter | Description |
|---|---|
--username USERNAME | Set the username |
--password PASSWORD | Set the password |
--ssh-key KEY | Configure SSH public-key authentication (the password is empty when a public key is used) |
--ssh-port PORT | Change the SSH port, both during installation and in the new system |
--hold 1 | Boot into the installation environment without installing, to verify network connectivity |
--hold 2 | Do not reboot after installation, so you can connect over SSH and modify the system |
SSH public keys can be supplied in several formats: paste a public-key string directly, provide an HTTP URL or a local file path, or use github:username or gitlab:username to fetch keys automatically.
Complete example with parameters
bash reinstall.sh debian 13 --ssh-port 10000 --password 'YourStrongPassword'
6. Monitor installation progress
After rebooting, the machine enters the installation environment. You can monitor progress through:
- SSH: connect to the VPS IP address using your configured port.
- A browser: visit
http://VPS_IPdirectly (port 80 by default, or a port specified with--web-port). - The provider’s VNC console or a serial console.
Even if installation fails, you can connect over SSH to recover the system manually.
7. Precautions
- If you change the SSH port or switch to key-based authentication after reinstallation, also check the configuration files in
/etc/ssh/sshd_config.d/. - The script maximizes usable disk space by omitting boot and swap partitions.
- To speed up installation, the script does not update the new system during reinstallation. Update it yourself afterward.
8. Other features
In addition to reinstalling Linux, the script supports the following features. See the project README if you need them:
- One-click Windows reinstallation: uses official original ISO images and automatically installs drivers such as VirtIO; supports Vista through 11 and Server 2008 through 2025.
- Writing raw disk images to disk: supports raw and fixed-size vhd images, with gz/xz/zst compression.
- Booting into Alpine Live OS: leaves the original system intact for manual backups, partitioning, and similar operations.
- Booting into netboot.xyz: install additional systems manually through VNC.