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-01-27 23:08:34 +08:00
- By default, the official installation program is used. When the memory requirements of the installation program are not met, the official cloud image (Cloud Image) will be used.
- The script does not include third-party links or homemade packages; all resources are obtained in real-time from the source site.
- Compatible with 512M + 5G small servers and supports installing Alpine on 256M small servers.
- 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.
- Progress of DD and cloud image installation can be viewed through SSH, browser, serial console, and background VNC.
- 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-01-27 23:08:34 +08:00
- For machines with static IP, install CentOS, Alma, Rocky, Fedora, Debian, Ubuntu, and add the --ci parameter to force the use of the cloud image.
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-01-27 23:08:34 +08:00
opensuse 15.5|tumbleweed (only supports cloud image)
arch (only supports amd64 cloud image)
gentoo (only supports amd64 cloud image)
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-01-28 22:46:38 +08:00
### Feature 4: Reboot to [netboot.xyz](https://netboot.xyz/)
2024-01-27 23:08:34 +08:00
- Can install more systems using background 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.
4. If the machine has a static IP, the IP will be automatically set after installation.
5. Can bypass Windows 11 hardware restrictions.
6. Supports Azure ARM (Hyper-V), does not support Oracle ARM (KVM).
7. 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-01-28 22:46:38 +08:00
8. The following website provides iso links.
2023-12-16 16:41:34 +08:00
< https: / / massgrave . dev / genuine-installation-media . html >
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 |
| Gentoo | - | 512M |
| 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
## Network Requirements
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
Install Linux using the `Install Mode` must have DHCPv4.
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
Other cases support static IP, IPv6 (including installing Alpine, Linux cloud image, Windows iso, dd).
2023-12-16 16:41:34 +08:00
2024-01-27 23:08:34 +08:00
No need to fill in the static IP address when running the script.
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
## TODO
2024-01-27 23:08:34 +08:00
- Install mode: Static IP, IPv6, multiple NICs
2024-01-19 11:55:35 +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/)
[![DartNode ](https://github.com/bin456789/reinstall/assets/7548515/12e3df20-06b8-4825-8319-65351f06e1ad )](https://dartnode.com/)