reinstall/README.en.md

290 lines
16 KiB
Markdown
Raw Normal View History

2024-05-22 22:32:43 +08:00
<!-- markdownlint-disable MD028 MD033 MD045 -->
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
# reinstall
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
[![Codacy](https://img.shields.io/codacy/grade/dc679a17751448628fe6d8ac35e26eed?logo=Codacy&label=Codacy)](https://app.codacy.com/gh/bin456789/reinstall/dashboard)
[![CodeFactor](https://img.shields.io/codefactor/grade/github/bin456789/reinstall?logo=CodeFactor&logoColor=white&label=CodeFactor)](https://www.codefactor.io/repository/github/bin456789/reinstall)
[![Lines of Code](https://aschey.tech/tokei/github/bin456789/reinstall?category=code&label=Lines%20of%20Code)](https://github.com/aschey/vercel-tokei)
<!-- [![Lines of Code](https://tokei.rs/b1/github/bin456789/reinstall?category=code&style=flat&label=Lines%20of%20Code)](https://github.com/XAMPPRocky/tokei_rs) -->
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
Reinstall server with one-click [中文](README.md)
2023-12-16 16:41:34 +08:00
## Highlights
2024-05-22 22:32:43 +08:00
- Support installation of 12 common Linux distributions.
- Support for installing Windows using the official original ISO. The script can automatically search for the ISO and drivers.
- Support reinstallation in any direction, meaning `Linux to Linux`, `Linux to Win`, `Win to Win`, `Win to Linux`.
- Specifically tailored for low-spec machines, addressing insufficient memory that prevents network installation.
- Automatically detect dynamic and static IPv4 / IPv6, eliminating the need to fill in IP / subnet mask / gateway.
- Support ARM, BIOS, EFI boot, with original system supporting LVM, BTRFS.
- No third-party custom packages included, all resources obtained in real-time from source sites.
2024-01-27 23:08:34 +08:00
- Includes many comments.
2023-12-16 16:41:34 +08:00
2024-05-03 21:37:07 +08:00
## System Requirements
2024-05-22 22:32:43 +08:00
| Target System | Version | Memory | Disk |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ---------------------- |
| <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB |
| <img width="16" height="16" src="https://www.debian.org/favicon.ico" /> Debian | 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
| <img width="16" height="16" src="https://github.com/bin456789/reinstall/assets/7548515/f74b3d5b-085f-4df3-bcc9-8a9bd80bb16d" /> Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ |
| <img width="16" height="16" src="https://netplan.readthedocs.io/en/latest/_static/favicon.png" /> Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB |
| <img width="16" height="16" src="https://www.centos.org/assets/img/favicon.png" /> CentOS | 7, 9 (stream) | 512 MB \* | 5 GB |
2024-05-22 22:32:43 +08:00
| <img width="16" height="16" src="https://www.oracle.com/asset/web/favicons/favicon-32.png" /> Oracle | 7, 8, 9 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://almalinux.org/fav/favicon.ico" /> Alma | 8, 9 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://rockylinux.org/favicon.png" /> Rocky | 8, 9 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://fedoraproject.org/favicon.ico" /> Fedora | 39, 40 | 512 MB \* | 5 GB |
| <img width="16" height="16" src="https://static.opensuse.org/favicon.ico" /> openSUSE | 15.5, 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB |
2024-05-22 22:32:43 +08:00
| <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | Rolling | 512 MB | 5 GB |
| <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | Rolling | 512 MB | 5 GB |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | Any | 512 MB | Depending on the image |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB |
2024-06-03 23:26:55 +08:00
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB |
2024-05-22 22:32:43 +08:00
(\*) Indicates installation using cloud images, not traditional network installation.
2024-05-03 21:37:07 +08:00
(^) indicates requiring either 256 MB memory + 1.5 GB disk, or 512 MB memory + 1 GB disk
2024-05-22 22:32:43 +08:00
> [!WARNING]
> ❌ This script does not support OpenVZ or LXC virtual machines.
>
> Please use <https://github.com/LloydAsp/OsMutation> instead.
## System Accounts
| System | Username | Password |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------------- |
| <img width="16" height="16" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux | root | 123@@@ |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | administrator | 123@@@ |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | Image username | Image password |
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
> [!TIP]
> If remote login to Windows fails, try using the username `.\administrator`.
## Download (Current system is <img width="20" height="20" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux)
For server outside China:
2023-12-16 16:41:34 +08:00
```bash
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
```
2024-05-22 22:32:43 +08:00
For server inside China:
2023-12-16 16:41:34 +08:00
```bash
2024-04-06 00:16:10 +08:00
curl -O https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
2023-12-16 16:41:34 +08:00
```
2024-05-22 22:32:43 +08:00
## Download (Current system is <img width="20" height="20" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows)
> [!IMPORTANT]
> Before proceeding, please disable the 'Real-time protection' feature in `Windows Defender`. This feature may prevent `certutil` from downloading any files.
<details>
<summary>😢Still unable to download?</summary>
### Try the following methods
1. For Windows 7, install this patch to enable TLS 1.2.
<https://aka.ms/easyfix51044>
2. Update SSL root certificates.
2024-01-27 23:08:34 +08:00
2024-05-22 22:32:43 +08:00
```batch
certutil -generateSSTFromWU root.sst
certutil -addstore Root root.sst
```
3. Download manually by copying these two files through `Remote Desktop Connection`.
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
2024-01-28 22:46:38 +08:00
2024-05-22 22:32:43 +08:00
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
</details>
2024-01-27 23:08:34 +08:00
2024-05-22 22:32:43 +08:00
For server outside China:
2024-01-27 23:08:34 +08:00
```batch
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
```
2024-05-22 22:32:43 +08:00
For server inside China:
2024-01-27 23:08:34 +08:00
```batch
2024-04-06 00:16:10 +08:00
certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
2024-01-27 23:08:34 +08:00
```
## Usage
2024-05-22 22:32:43 +08:00
> [!TIP]
> All features can be used on both Linux and Windows.
>
> on Linux, execute `bash reinstall.sh`
>
> on Windows, execute `reinstall.bat`
2024-01-28 22:46:38 +08:00
2024-05-22 22:32:43 +08:00
### Feature 1: Install <img width="16" height="16" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux
2023-12-16 16:41:34 +08:00
2024-04-25 22:43:11 +08:00
- If no version number is entered, the latest version will be installed.
2024-05-22 22:32:43 +08:00
- Does not include a boot partition (except for Fedora), nor a swap partition, maximizing disk space utilization.
- When installing on a virtual machine, it will automatically select a official limmed-down kernel.
> [!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).
2023-12-16 16:41:34 +08:00
```bash
2024-06-03 23:26:55 +08:00
bash reinstall.sh centos 7|9 (9 is stream version)
2024-05-03 23:34:42 +08:00
oracle 7|8|9
2023-12-16 16:41:34 +08:00
alma 8|9
rocky 8|9
2024-05-22 22:32:43 +08:00
fedora 39|40
2023-12-16 16:41:34 +08:00
debian 10|11|12
2024-04-25 22:24:46 +08:00
ubuntu 20.04|22.04|24.04
2024-05-22 22:32:43 +08:00
alpine 3.17|3.18|3.19|3.20
opensuse 15.5|15.6|tumbleweed
2024-05-03 21:37:07 +08:00
kali
2024-03-31 00:32:05 +08:00
arch
2024-03-28 00:16:05 +08:00
gentoo
2023-12-16 16:41:34 +08:00
```
2024-01-28 22:46:38 +08:00
### Feature 2: DD
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
- Supports gzip, xz formats.
- A machine with a static IP running DD Windows will automatically configure the IP, which may take a few minutes to complete after the first boot.
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
> [!TIP]
> Can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console).
2023-12-16 16:41:34 +08:00
```bash
2024-01-27 23:08:34 +08:00
bash reinstall.sh dd --img https://example.com/xxx.xz
2023-12-16 16:41:34 +08:00
```
2024-05-22 22:32:43 +08:00
### Feature 3: Reboot to <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Rescue System (Live OS)
2024-01-27 23:08:34 +08:00
- Can be connected via SSH to perform manual DD, modify partitions, manually install Arch / Gentoo, etc.
- If the disk content is not modified, rebooting again will return to the original system.
2023-12-16 16:41:34 +08:00
```bash
bash reinstall.sh alpine --hold=1
```
2024-05-22 22:32:43 +08:00
### Feature 4: Reboot to <img width="16" height="16" src="https://netboot.xyz/img/favicon.ico" /> netboot.xyz
2024-01-27 23:08:34 +08:00
2024-05-03 21:37:07 +08:00
- Can 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.
2024-04-06 00:16:10 +08:00
- If the disk content is not modified, rebooting again will return to the original system.
2023-12-16 16:41:34 +08:00
```bash
bash reinstall.sh netboot.xyz
```
2024-01-27 23:08:34 +08:00
![netboot.xyz](https://netboot.xyz/images/netboot.xyz.gif)
2024-05-22 22:32:43 +08:00
### Feature 5: Install <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows ISO
- Can automatically searching for most iso links. Need to set the language using `--lang`, default is `en-us`.
- Machines with static IP addresses will have their IPs automatically configured after installation.
- Can bypass Windows 11 installation restrictions.
> [!TIP]
> The script uses <https://massgrave.dev/genuine-installation-media.html> as the ISO source. All ISOs provided are official originals.
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
> [!IMPORTANT]
> Note that parameters should be enclosed in quotation marks.
2024-02-02 00:49:24 +08:00
2023-12-16 16:41:34 +08:00
```bash
bash reinstall.sh windows \
2024-04-05 22:45:59 +08:00
--image-name 'Windows 10 Enterprise LTSC 2021' \
2024-05-03 21:37:07 +08:00
--lang zh-cn
2024-04-05 22:45:59 +08:00
```
2024-05-03 21:37:07 +08:00
- You can also specify an ISO link.
2024-04-05 22:45:59 +08:00
```bash
bash reinstall.sh windows \
--image-name 'Windows 10 Enterprise LTSC 2021' \
2024-05-03 21:37:07 +08:00
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso'
2023-12-16 16:41:34 +08:00
```
2024-05-22 22:32:43 +08:00
<details>
<summary>The following website provides iso links.</summary>
- Massgrave
- <https://massgrave.dev/genuine-installation-media.html> (Recommended, iso sourced from official channels, updated monthly, includes the latest patches)
- Microsoft
- <https://www.microsoft.com/software-download/windows8>
- <https://www.microsoft.com/software-download/windows10> (Need to open it with a mobile 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>
2024-05-22 22:32:43 +08:00
- <https://www.microsoft.com/evalcenter/download-windows-server-2022>
2024-06-03 21:44:36 +08:00
- <https://www.microsoft.com/evalcenter/download-windows-server-2025>
2024-05-22 22:32:43 +08:00
</details>
2024-02-02 00:49:24 +08:00
![Installing Windows](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)
2024-01-27 23:08:34 +08:00
2024-05-22 22:32:43 +08:00
#### Parameters Description
2023-12-16 16:41:34 +08:00
2024-04-05 22:45:59 +08:00
`--image-name` Specify the image to install, case-insensitive, Commonly used images include:
2023-12-16 16:41:34 +08:00
```text
2024-02-02 00:49:24 +08:00
Windows 7 Ultimate
Windows 10 Enterprise LTSC 2021
Windows 11 Pro
Windows Server 2022 SERVERDATACENTER
2023-12-16 16:41:34 +08:00
```
2024-01-27 23:08:34 +08:00
Use `Dism++` File menu > Open Image File, select the iso to be installed to get the image name.
2023-12-16 16:41:34 +08:00
![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)
2024-05-22 22:32:43 +08:00
#### Supported systems
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
- Windows (Vista ~ 11)
2024-06-03 21:44:36 +08:00
- Windows Server (2008 ~ 2025)
2024-06-14 23:41:15 +08:00
- Windows Server Essentials *
- Windows Server (Semi) Annual Channel *
- Hyper-V Server *
- Azure Stack HCI *
\* Must specify an ISO link.
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
#### The script will install the following drivers as needed
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
- KVM ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/))
- XEN ([XEN](https://xenproject.org/windows-pv-drivers/), [Citrix](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade), [AWS](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html))
- AWS ([ENA Network Adapter](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html), [NVMe Storage Controller](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html))
- GCP ([gVNIC Network Adapter](https://cloud.google.com/compute/docs/networking/using-gvnic), [GGA Graphics](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))
2024-02-02 00:49:24 +08:00
2024-05-22 22:32:43 +08:00
> [!WARNING]
> Vista (Server 2008) and 32-bit systems may lack drivers.
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
> [!WARNING]
> For EFI machines without CSM enabled, Windows 7 (Server 2008 R2) cannot be installed.
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
> [!WARNING]
> Supports installation of Windows 11 on ARM machines, limited to Hyper-V (Azure) only, not supported on KVM (Oracle Cloud).
2023-12-16 16:41:34 +08:00
2024-05-22 22:32:43 +08:00
> [!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>.
2023-12-16 16:41:34 +08:00
2024-02-02 00:49:24 +08:00
## Thanks
Thanks to the following businesses for providing free servers.
2024-01-19 11:55:35 +08:00
2024-02-02 00:49:24 +08:00
[![Oracle Cloud](https://github.com/bin456789/reinstall/assets/7548515/8b430ed4-8344-4f96-b4da-c2bda031cc90)](https://www.oracle.com/cloud/)
2024-03-01 00:22:04 +08:00
[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/435d6740-bcdd-4f3a-a196-2f60ae397f17)](https://dartnode.com/)