2023-12-16 16:41:34 +08:00
# reinstall
[![Codacy Badge ](https://app.codacy.com/project/badge/Grade/dc679a17751448628fe6d8ac35e26eed )](https://app.codacy.com/gh/bin456789/reinstall/dashboard?utm_source=gh& utm_medium=referral& utm_content=& utm_campaign=Badge_grade)
[![CodeFactor ](https://www.codefactor.io/repository/github/bin456789/reinstall/badge )](https://www.codefactor.io/repository/github/bin456789/reinstall)
2024-01-27 23:08:34 +08:00
[![Lines of Code ](https://tokei.rs/b1/github/bin456789/reinstall?category=code&style=flat )](https://github.com/XAMPPRocky/tokei_rs)
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
One-click reinstallation script
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
[中文 ](README.md ) | English
2023-12-16 16:41:34 +08:00
## Highlights
2024-03-17 00:08:48 +08:00
- Installing using official cloud images (Cloud Image) allows bypassing the [memory requirements ](https://access.redhat.com/articles/rhel-limits#minimum-required-memory-3 ) of traditional network installations, resulting in faster installation speed.
- Using official cloud images for installation ensures fast installation speed and can also avoid issues with netboot installation on machines with limited memory.
2024-01-27 23:08:34 +08:00
- Compatible with 512M + 5G small servers and supports installing Alpine on 256M small servers.
2024-03-17 00:08:48 +08:00
- Compatible with all network conditions, including dynamic/static IPv4/IPv6 and pure IPv4/IPv6.
2024-01-27 23:08:34 +08:00
- Supports installing Windows using the official ISO.
- Supports reinstalling Windows as Linux or Windows itself.
- Supports BIOS, EFI, ARM.
- The original system partition supports LVM, Btrfs.
- Supports installing Alpine, Arch, openSUSE, Gentoo, and can also install these systems from them.
2024-03-01 00:22:04 +08:00
- Progress of DD and cloud image installation can be viewed through SSH, browser, serial console, and web panel VNC.
2024-03-17 00:08:48 +08:00
- The script does not include third-party links or homemade packages; all resources are obtained in real-time from the source site.
2024-01-27 23:08:34 +08:00
- Includes many comments.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
## Download (Current system is Linux)
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
For users outside China:
2023-12-16 16:41:34 +08:00
```bash
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
```
2024-01-27 23:08:34 +08:00
For users in China:
2023-12-16 16:41:34 +08:00
```bash
2024-02-05 13:25:29 +08:00
curl -O https://raw.gitmirror.com/bin456789/reinstall/main/reinstall.sh
2023-12-16 16:41:34 +08:00
```
2024-01-27 23:08:34 +08:00
## Download (Current system is Windows)
2024-01-28 22:46:38 +08:00
[Unable to download? ](#if-the-script-cannot-be-downloaded-under-windows )
Before proceeding, please disable the 'Real-time protection' feature in `Windows Defender` . This feature may prevent `certutil` from downloading any files.
2024-01-27 23:08:34 +08:00
For users outside China:
```batch
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
```
For users in China:
```batch
2024-02-05 13:25:29 +08:00
certutil -urlcache -f -split https://raw.gitmirror.com/bin456789/reinstall/main/reinstall.bat
2024-01-27 23:08:34 +08:00
```
## Usage
2024-01-28 22:46:38 +08:00
All features can be used on both Linux and Windows.
- on Linux, execute `bash reinstall.sh`
- on Windows, execute `reinstall.bat`
2024-01-27 23:08:34 +08:00
2024-01-28 22:46:38 +08:00
### Feature 1: Install Linux
2023-12-16 16:41:34 +08:00
2024-03-17 00:08:48 +08:00
- The parameter --ci indicates forced usage of the cloud image for installation.
- Machines with static IP installing CentOS, Alma, Rocky, Fedora, Ubuntu must include the parameter `--ci` .
- If it is uncertain whether the machine has a static or dynamic IP, you can also add the parameter `--ci` .
2023-12-16 16:41:34 +08:00
```bash
2024-01-27 23:08:34 +08:00
bash reinstall.sh centos 7|8|9 (8|9 for the stream version)
2023-12-16 16:41:34 +08:00
alma 8|9
rocky 8|9
fedora 38|39
debian 10|11|12
ubuntu 20.04|22.04
alpine 3.16|3.17|3.18|3.19
2024-03-17 00:08:48 +08:00
opensuse 15.5|tumbleweed
arch (not supports ARM)
2024-03-28 00:16:05 +08:00
gentoo
2024-01-27 23:08:34 +08:00
If no version number is entered, the latest version will be installed.
```
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
Parameters:
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
```bash
--ci Force the use of the cloud image
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.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
- For machines with static IP, DD Windows, and the script will automatically configure the IP.
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-01-28 22:46:38 +08:00
### Feature 3: Reboot to 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.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +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 alpine --hold=1
```
2024-03-01 00:22:04 +08:00
### Feature 4: Reboot to netboot.xyz
2024-01-27 23:08:34 +08:00
2024-03-01 00:22:04 +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 web panel VNC.
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-01-28 22:46:38 +08:00
### Feature 5: Install Windows ISO
2023-12-16 16:41:34 +08:00
2024-02-02 00:49:24 +08:00
- Pay attention to the quotation marks around the parameters
2023-12-16 16:41:34 +08:00
```bash
bash reinstall.sh windows \
2024-01-27 23:08:34 +08:00
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
--image-name 'Windows 10 Enterprise LTSC 2021'
2023-12-16 16:41:34 +08:00
```
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
Parameters:
2023-12-16 16:41:34 +08:00
2024-01-28 22:46:38 +08:00
`--iso` Original image link
2023-12-16 16:41:34 +08:00
2024-02-02 00:49:24 +08:00
`--image-name` Specify the image to install, case-insensitive, for example:
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-01-27 23:08:34 +08:00
1. Supported systems:
2024-02-02 00:49:24 +08:00
- Windows Vista to 11
- Windows Server 2008 to 2022, including the following variants
2024-01-27 23:08:34 +08:00
- Windows Server Essentials
- Windows Server Annual Channel
- Hyper-V Server
- Azure Stack HCI
2024-01-28 22:46:38 +08:00
2. The script will install the following drivers as needed:
- KVM ([Virtio ](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/ ))
- XEN ([XEN PV ](https://xenproject.org/windows-pv-drivers/ ), [AWS PV ](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/xen-drivers-overview.html ))
- AWS ([ENA Network Adapter ](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html ), [NVMe Storage Controller ](https://docs.aws.amazon.com/zh_cn/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/zh-cn/azure/virtual-network/accelerated-networking-mana-windows ))
3. Vista (Server 2008) and 32-bit systems may lack drivers.
2024-03-17 00:08:48 +08:00
4. For EFI machines without CSM enabled, Windows 7 (Server 2008 R2) cannot be installed.
5. If the machine has a static IP, the IP will be automatically set after installation.
6. Can bypass Windows 11 hardware restrictions.
7. Supports Windows 11 on ARM, exclusively for Hyper-V (Azure), not compatible with KVM (Oracle Cloud).
8. The process `wsappx` will occupy CPU for a long time after installing the image `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso` .
2023-12-16 16:41:34 +08:00
This is an issue with the image, and the solution is to install the `VCLibs` library.
< https: / / www . google . com / search ? q = ltsc+wsappx >
2024-03-17 00:08:48 +08:00
9. 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)
2023-12-16 16:41:34 +08:00
2024-03-17 00:08:48 +08:00
< https: / / www . microsoft . com / software-download / windows10 > (Need to open it with a mobile User-Agent)
< https: / / www . microsoft . com / software-download / windows11 >
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
## Memory Requirements
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
| System | Traditional Installation | Cloud Image |
| ------------------------------------- | ------------------------ | ----------- |
| Debian | 384M | 512M |
| Ubuntu | 1G | 512M |
| CentOS / Alma / Rocky / Fedora | 1G | 512M |
| Alpine | 256M | - |
| openSUSE | - | 512M |
| Arch | - | 512M |
2024-03-28 00:16:05 +08:00
| Gentoo | 512M | - |
2024-01-27 23:08:34 +08:00
| Windows 8.1 (Server 2012 R2) or below | 512M | - |
| Windows 10 (Server 2016) or above | 1G | - |
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
## Virtualization Requirements
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
Not supported on OpenVZ, LXC virtual machines.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
Please use < https: / / github . com / LloydAsp / OsMutation > .
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
## Default Passwords
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
| System | Username | Password |
| ------------- | -------------- | -------------- |
| Linux | root | 123@@@ |
| Windows (iso) | administrator | 123@@@ |
| Windows (dd) | Image username | Image password |
2023-12-16 16:41:34 +08:00
2024-02-02 00:49:24 +08:00
If encountering a password error during remote login to Windows, try using the username .\administrator.
2024-01-27 23:08:34 +08:00
## If the script cannot be downloaded under Windows
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
You can try the following methods:
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
1. Disable Windows Defender Real-time Protection.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
2. For Windows 7, install this patch to enable TLS 1.2.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
< https: / / aka . ms / easyfix51044 >
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
3. Update SSL root certificates.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
```batch
certutil -generateSSTFromWU root.sst
certutil -addstore Root root.sst
```
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
4. Download manually by copying these two files through `Remote Desktop Connection` .
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
< https: / / raw . githubusercontent . com / bin456789 / reinstall / main / reinstall . bat >
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
< https: / / raw . githubusercontent . com / bin456789 / reinstall / main / reinstall . sh >
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/)