一键DD/重装脚本 (One-click reinstall OS on VPS)
Go to file
2024-01-22 00:21:37 +08:00
.github/workflows core: 不重要的优化 2023-12-16 16:41:34 +08:00
.editorconfig core: 添加 .editorconfig 2023-12-04 22:20:52 +08:00
alpine-network.sh core: 提前适配 alpine 3.19.1 2024-01-20 22:27:01 +08:00
cloud-init.yaml core: 修复未正常识别 sshd 配置目录 2023-12-02 23:46:07 +08:00
debian.cfg debian: 国内使用清华源 2023-11-01 23:14:13 +08:00
logviewer-nginx.conf core: 日志网页使用异步刷新 2023-10-25 14:19:25 +08:00
logviewer.html core: 修复 wget 换行符为 \r 导致 html 日志不换行 2023-11-06 19:08:23 +08:00
README.en.md docs: 更新文档 2024-01-19 11:55:35 +08:00
README.md docs: 更新文档 2024-01-19 11:55:35 +08:00
redhat.cfg core: 修改主硬盘查找逻辑 2023-10-08 21:46:45 +08:00
reinstall.bat core: 修复 powershell 下无法正确传递 --image-name 参数 2023-12-25 22:05:24 +08:00
reinstall.sh core: 提前适配 alpine 3.19.1 2024-01-20 22:27:01 +08:00
resize.sh chore: lint 2023-12-05 22:41:36 +08:00
trans.sh core: 存放 qcow2 的分区设为 1G 2024-01-22 00:21:37 +08:00
ttys.sh core: tty0 优先 2023-10-27 12:09:45 +08:00
ubuntu-storage-early.sh chore: lint 2023-12-05 22:41:36 +08:00
ubuntu.yaml ubuntu: 安装大厂内核 2023-08-28 19:33:53 +08:00
windows-del-gpo.bat windows: dd / iso 安装后添加静态网络配置 2023-10-22 18:43:54 +08:00
windows-resize.bat windows: dd / iso 安装后添加静态网络配置 2023-10-22 18:43:54 +08:00
windows-set-netconf.bat core: 完善 slaac 下的 dns 配置 2023-10-28 21:46:38 +08:00
windows-setup.bat windows: 在 pe 下重设 efi 分区大小 2024-01-18 22:43:39 +08:00
windows.xml windows: 修复 vultr 下无法安装 win8/8.1/2012/2012r2 2024-01-18 18:44:41 +08:00

reinstall

Codacy Badge CodeFactor Lines of Code

One-click Reinstallation Script

中文 | English

Highlights

  • Default usage of official installation programs. In cases where the memory requirements of the installation program are not met, the official cloud image will be used.
  • Excludes third-party links and self-made packages; all resources are fetched in real-time from the source site.
  • Adapted for 512M + 5G small VPS, and supports installing Alpine on 256M VPS.
  • Supports installing Windows using the official ISO (does not support ARM).
  • Supports reinstalling Windows as Linux and vice versa.
  • Supports BIOS, EFI, ARM (Windows installation not supported on ARM).
  • Supports original system partition with LVM, Btrfs.
  • Supports installing Alpine, Arch, openSUSE, Gentoo, and installing from these systems.
  • Progress of DD and cloud image installation can be viewed through SSH, a browser, serial console, or background VNC.
  • Contains extensive comments.

Usage on Linux

Download

curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh

Download (from within China)

curl -O https://raw.fgit.cf/bin456789/reinstall/main/reinstall.sh

Usage 1: Install Linux

Note: For machines with static IP, installing centos, alma, rocky, fedora, debian, ubuntu, requires adding the --ci parameter to force the use of the cloud mirror.

bash reinstall.sh centos   7|8|9  (8|9 for stream versions)
                  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
                  opensuse 15.5|tumbleweed (supports cloud mirror only)
                  arch     (supports only amd64 cloud mirror)
                  gentoo   (supports only amd64 cloud mirror)

                  If no version number is entered, it installs the latest version.

Optional parameters: --ci     Force the use of the cloud mirror.

Usage 2: DD

Supports gzip, xz formats.

Supports automatic configuration of static IP, system disk expansion.

bash reinstall.sh dd --img=https://example.com/xxx.xz

Usage 3: Restart to Alpine Rescue System (Live OS)

Can be connected via SSH to perform manual DD, modify partitions, manually install Arch Linux, and other operations.

bash reinstall.sh alpine --hold=1

Usage 4: Restart to netboot.xyz

bash reinstall.sh netboot.xyz

Usage 5: Install Windows ISO

bash reinstall.sh windows \
     --iso='https://example.com/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \
     --image-name='Windows 10 Enterprise LTSC 2021'

Parameter Description

--iso Original image link without integrating VirtIO, Xen, AWS, GCP drivers.

--image-name Specifies the image to install, case insensitive, enclosed in quotes, for example:

'Windows 7 Ultimate'
'Windows 10 Enterprise LTSC 2021'
'Windows 11 Pro'
'Windows Server 2022 SERVERDATACENTER'

Use Dism++ File menu > Open image file, select the iso to get the image name.

image-name

Other Notes

  1. Successfully tested systems: 7, 10, 11, 2022. Tested platforms: vultr (bios), oracle (efi), aws t2 (xen), aws t3 (nitro).

  2. Supports 32/64-bit systems; UEFI machines only support 64-bit.

  3. Can bypass Windows 11 hardware restrictions.

  4. Tested not to support ARM.

  5. zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso: After installing this image, the wsappx process may occupy CPU for an extended period.

    This is an issue with the image, and the solution is to install the VCLibs library.

    https://www.google.com/search?q=ltsc+wsappx

  6. The following websites contain iso links:

    https://archive.org

    https://massgrave.dev/genuine-installation-media.html

Usage on Windows

Run cmd with administrator privileges.

If running powershell, switch to cmd first.

Download

certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat

Download (from within China)

certutil -urlcache -f -split https://raw.fgit.cf/bin456789/reinstall/main/reinstall.bat

If unable to download

Usage

All functionalities available in Linux can be used on Windows, using parameters similar to those in Linux.

For example, to install centos 7:

reinstall.bat centos-7

Memory Requirements

System Traditional Install Cloud Image
Debian 384M 512M
Ubuntu 1G 512M
CentOS / Alma / Rocky / Fedora 1G 512M
Alpine 256M -
openSUSE - 512M
Arch - 512M
Gentoo - 512M
Windows 1G -

Network Requirements

For 'Installation Mode' installing Linux, DHCPv4 is required.

Other cases support static IP, IPv6 (including installing Alpine, cloud mirror, Windows iso, dd).

No need to fill in the static IP address when running the script.

Virtualization Requirements

Does not support OpenVZ, LXC virtual machines.

Please use https://github.com/LloydAsp/OsMutation.

Default Passwords

System Username Password
Linux root 123@@@
Windows (ISO install) administrator 123@@@

TODO

  • Installation modes: Static IP, IPv6, multiple NICs.

Sponsor

DartNode