mirror of
https://github.com/bin456789/reinstall.git
synced 2025-12-10 15:37:43 +08:00
不重要的优化
This commit is contained in:
266
README.md
266
README.md
@ -1,71 +1,115 @@
|
||||
<!-- markdownlint-disable MD028 MD033 MD045 -->
|
||||
|
||||
# reinstall
|
||||
|
||||
[](https://app.codacy.com/gh/bin456789/reinstall/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
||||
[](https://www.codefactor.io/repository/github/bin456789/reinstall)
|
||||
[](https://github.com/XAMPPRocky/tokei_rs)
|
||||
[](https://app.codacy.com/gh/bin456789/reinstall/dashboard)
|
||||
[](https://www.codefactor.io/repository/github/bin456789/reinstall)
|
||||
[](https://github.com/XAMPPRocky/tokei_rs)
|
||||
|
||||
一键重装脚本
|
||||
|
||||
中文 | [English](README.en.md)
|
||||
一键重装脚本 [English](README.en.md)
|
||||
|
||||
## 亮点
|
||||
|
||||
- 支持以下系统任意转换(包括 Windows 转 Linux)
|
||||
- 适配低配小鸡,并自动选择合适的官方精简内核
|
||||
- 支持用官方 iso 安装 Windows
|
||||
- 自动判断动静态 IPv4 / IPv6,无需填写 IP / 掩码 / 网关(即使是 DD / ISO 安装 Windows)
|
||||
- 支持 BIOS、EFI、ARM,原系统分区支持 lvm、btrfs
|
||||
- 可通过 SSH、HTTP 80 端口、串行控制台、商家后台 VNC 查看 DD、云镜像安装进度
|
||||
- 支持安装 12 种常见 Linux 发行版
|
||||
- 支持用官方原版 iso 安装 Windows,并且脚本会自动查找 iso 和驱动
|
||||
- 支持任意方向重装,也就是支持 `Linux to Linux`、`Linux to Win`、`Win to Win`、`Win to Linux`
|
||||
- 专门适配低配小鸡,解决内存过少导致无法进行网络安装
|
||||
- 自动判断动静态 IPv4 / IPv6,无需填写 IP / 掩码 / 网关
|
||||
- 支持 ARM,支持 BIOS、EFI 引导,原系统支持 LVM、BTRFS
|
||||
- 不含第三方自制包,所有资源均实时从源站点获得
|
||||
- 有很多注释
|
||||
|
||||
## 配置要求
|
||||
|
||||
| 目标系统 | 内存 | 硬盘 |
|
||||
| ---------------------------------------------- | --------- | ---------- |
|
||||
| Alpine | 256 MB | 1 GB |
|
||||
| Debian / Kali | 256 MB | 1~1.5 GB ^ |
|
||||
| Ubuntu | 512 MB \* | 2 GB |
|
||||
| CentOS / Alma / Rocky / Oracle | 512 MB \* | 5 GB |
|
||||
| Fedora | 512 MB \* | 5 GB |
|
||||
| openSUSE | 512 MB \* | 5 GB |
|
||||
| Arch | 512 MB | 5 GB |
|
||||
| Gentoo | 512 MB | 5 GB |
|
||||
| DD | 512 MB | 取决于镜像 |
|
||||
| Windows 8.1 (Server 2012 R2) 或以下 (ISO 安装) | 512 MB | 20~25 GB |
|
||||
| Windows 10 (Server 2016) 或以上 (ISO 安装) | 1024 MB | 20~25 GB |
|
||||
| 目标系统 | 版本 | 内存 | 硬盘 |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ------------ |
|
||||
| <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 | 滚动 | 256 MB | 1 ~ 1.5 GB ^ |
|
||||
| <img width="16" height="16" src="https://assets.ubuntu.com/v1/49a1a858-favicon-32x32.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, 8, 9 | 512 MB \* | 5 GB |
|
||||
| <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, Tumbleweed (滚动) | 512 MB \* | 5 GB |
|
||||
| <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | 滚动 | 512 MB | 5 GB |
|
||||
| <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | 滚动 | 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) | 任何 | 512 MB | 取决于镜像 |
|
||||
| <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 |
|
||||
| <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 ~ 2022) | 1 GB | 25 GB |
|
||||
|
||||
(\*) 表示使用云镜像安装
|
||||
(\*) 表示使用云镜像安装,非传统网络安装
|
||||
|
||||
(^) 需要 256 MB 内存 + 1.5 GB 硬盘,或 512 MB 内存 + 1 GB 硬盘
|
||||
|
||||
## 下载(当前系统是 Linux)
|
||||
> [!WARNING]
|
||||
> ❌ 本脚本不支持 OpenVZ、LXC 虚拟机
|
||||
>
|
||||
> 请改用 <https://github.com/LloydAsp/OsMutation>
|
||||
|
||||
国外:
|
||||
## 系统账号
|
||||
|
||||
| 系统 | 用户名 | 密码 |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -------- |
|
||||
| <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) | 镜像用户名 | 镜像密码 |
|
||||
|
||||
> [!TIP]
|
||||
> 如果远程登录 Windows 失败,尝试使用用户名 `.\administrator`
|
||||
|
||||
## 下载(当前系统是 <img width="20" height="20" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux)
|
||||
|
||||
国外服务器:
|
||||
|
||||
```bash
|
||||
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
||||
```
|
||||
|
||||
国内:
|
||||
国内服务器:
|
||||
|
||||
```bash
|
||||
curl -O https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
|
||||
```
|
||||
|
||||
## 下载(当前系统是 Windows)
|
||||
## 下载(当前系统是 <img width="20" height="20" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows)
|
||||
|
||||
[无法下载?](#如果-windows-下无法下载脚本)
|
||||
> [!IMPORTANT]
|
||||
> 请先关闭 `Windows Defender` 的 `实时保护` 功能。该功能会阻止 `certutil` 下载任何文件。
|
||||
|
||||
请先关闭 `Windows Defender` 的 `实时保护` 功能。该功能会阻止 `certutil` 下载任何文件
|
||||
<details>
|
||||
|
||||
国外:
|
||||
<summary>😢还是无法下载?</summary>
|
||||
|
||||
### 可尝试以下几种方法
|
||||
|
||||
1. Windows 7 安装此补丁启用 TLS 1.2
|
||||
|
||||
<https://aka.ms/easyfix51044>
|
||||
|
||||
2. 更新 SSL 根证书
|
||||
|
||||
```batch
|
||||
certutil -generateSSTFromWU root.sst
|
||||
certutil -addstore Root root.sst
|
||||
```
|
||||
|
||||
3. 手动下载,通过 `远程桌面` 复制这两个文件
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
||||
|
||||
</details>
|
||||
|
||||
国外服务器:
|
||||
|
||||
```batch
|
||||
certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
|
||||
```
|
||||
|
||||
国内:
|
||||
国内服务器:
|
||||
|
||||
```batch
|
||||
certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
|
||||
@ -73,26 +117,35 @@ certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubuserco
|
||||
|
||||
## 使用
|
||||
|
||||
所有功能均可在 Linux / Windows 下使用
|
||||
> [!TIP]
|
||||
>
|
||||
> 所有功能均可在 Linux / Windows 下使用。
|
||||
>
|
||||
> Linux 下运行 `bash reinstall.sh`
|
||||
>
|
||||
> Windows 下运行 `reinstall.bat`
|
||||
|
||||
- Linux 下运行 `bash reinstall.sh`
|
||||
- Windows 下运行 `reinstall.bat`
|
||||
|
||||
### 功能 1: 安装 Linux
|
||||
### 功能 1: 安装 <img width="16" height="16" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux
|
||||
|
||||
- 不输入版本号,则安装最新版
|
||||
- 在虚拟机上,会自动安装精简内核
|
||||
- 不含 boot 分区(Fedora 例外),不含 swap 分区,最大化利用磁盘空间
|
||||
- 在虚拟机上,会自动安装官方精简内核
|
||||
|
||||
> [!TIP]
|
||||
> 安装 Debian / Kali 时,x86 可通过后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。
|
||||
>
|
||||
> 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。
|
||||
|
||||
```bash
|
||||
bash reinstall.sh centos 7|8|9 (8|9 为 stream 版本)
|
||||
oracle 7|8|9
|
||||
alma 8|9
|
||||
rocky 8|9
|
||||
fedora 38|39|40
|
||||
fedora 39|40
|
||||
debian 10|11|12
|
||||
opensuse 15.5|tumbleweed
|
||||
ubuntu 20.04|22.04|24.04
|
||||
alpine 3.16|3.17|3.18|3.19
|
||||
alpine 3.17|3.18|3.19|3.20
|
||||
kali
|
||||
arch
|
||||
gentoo
|
||||
@ -103,11 +156,14 @@ bash reinstall.sh centos 7|8|9 (8|9 为 stream 版本)
|
||||
- 支持 gzip、xz 格式
|
||||
- 静态 IP 的机器 DD Windows,会自动配置好 IP
|
||||
|
||||
> [!TIP]
|
||||
> 可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。
|
||||
|
||||
```bash
|
||||
bash reinstall.sh dd --img https://example.com/xxx.xz
|
||||
```
|
||||
|
||||
### 功能 3: 重启到 Alpine 救援系统 (Live OS)
|
||||
### 功能 3: 重启到 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine 救援系统 (Live OS)
|
||||
|
||||
- 可用 ssh 连接,进行手动 DD、修改分区、手动安装 Arch / Gentoo 等操作
|
||||
- 如果没有修改硬盘内容,再次重启将回到原系统
|
||||
@ -116,7 +172,7 @@ bash reinstall.sh dd --img https://example.com/xxx.xz
|
||||
bash reinstall.sh alpine --hold=1
|
||||
```
|
||||
|
||||
### 功能 4: 重启到 netboot.xyz
|
||||
### 功能 4: 重启到 <img width="16" height="16" src="https://netboot.xyz/img/favicon.ico" /> netboot.xyz
|
||||
|
||||
- 可使用商家后台 VNC 安装 [更多系统](https://github.com/netbootxyz/netboot.xyz?tab=readme-ov-file#what-operating-systems-are-currently-available-on-netbootxyz)
|
||||
- 如果没有修改硬盘内容,再次重启将回到原系统
|
||||
@ -127,10 +183,17 @@ bash reinstall.sh netboot.xyz
|
||||
|
||||

|
||||
|
||||
### 功能 5: 安装 Windows ISO
|
||||
### 功能 5: 安装 <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows ISO
|
||||
|
||||
- 注意参数两边的引号
|
||||
- 支持自动查找部分 iso 链接,需设置语言 `--lang`,默认 `en-us`
|
||||
- 支持自动查找大部分 iso 链接,需指定语言 `--lang`,默认 `en-us`
|
||||
- 静态 IP 的机器,安装后会自动配置好 IP
|
||||
- 能够绕过 Windows 11 安装限制
|
||||
|
||||
> [!TIP]
|
||||
> 脚本以 <https://massgrave.dev/genuine-installation-media.html> 作为 iso 镜像查找源。所有 iso 都是官方原版。
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 注意参数两边有引号。
|
||||
|
||||
```bash
|
||||
bash reinstall.sh windows \
|
||||
@ -146,9 +209,28 @@ bash reinstall.sh windows \
|
||||
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso'
|
||||
```
|
||||
|
||||
<details>
|
||||
|
||||
<summary>以下网站可找到 iso 链接</summary>
|
||||
|
||||
- Massgrave
|
||||
- <https://massgrave.dev/genuine-installation-media.html> (推荐,iso 来自官方,每月更新,包含最新补丁)
|
||||
- 微软
|
||||
- <https://www.microsoft.com/software-download/windows8>
|
||||
- <https://www.microsoft.com/software-download/windows10> (需用手机 User-Agent 打开)
|
||||
- <https://www.microsoft.com/software-download/windows11>
|
||||
- <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-server-2012-r2>
|
||||
- <https://www.microsoft.com/evalcenter/download-windows-server-2016>
|
||||
- <https://www.microsoft.com/evalcenter/download-windows-server-2019>
|
||||
- <https://www.microsoft.com/evalcenter/download-windows-server-2022>
|
||||
|
||||
</details>
|
||||
|
||||

|
||||
|
||||
参数说明:
|
||||
#### 参数说明
|
||||
|
||||
`--image-name` 指定要安装的映像,不区分大小写,常用映像有:
|
||||
|
||||
@ -163,78 +245,36 @@ Windows Server 2022 SERVERDATACENTER
|
||||
|
||||

|
||||
|
||||
1. 支持的系统:
|
||||
- Windows Vista 到 11
|
||||
- Windows Server 2008 到 2022,包括以下衍生版
|
||||
- Windows Server Essentials
|
||||
- Windows Server Annual Channel
|
||||
- Hyper-V Server
|
||||
- Azure Stack HCI
|
||||
2. 脚本会按需安装以下驱动:
|
||||
- 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 网卡](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html)、[NVME 存储控制器](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html))
|
||||
- GCP ([gVNIC 网卡](https://cloud.google.com/compute/docs/networking/using-gvnic)、[GGA 显卡](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display))
|
||||
- Azure ([MANA 网卡](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows))
|
||||
3. Vista (Server 2008) 和 32 位系统可能会缺少驱动
|
||||
4. 未开启 CSM 的 EFI 机器,无法安装 Windows 7 (Server 2008 R2)
|
||||
5. 静态 IP 的机器,安装后会自动配置好 IP
|
||||
6. 可绕过 Windows 11 硬件限制
|
||||
7. 支持 Windows 11 on ARM,仅限 Hyper-V (Azure) ,不支持 KVM (甲骨文云)
|
||||
8. `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso` 此镜像安装后 `wsappx` 进程会长期占用 CPU
|
||||
#### 支持的系统
|
||||
|
||||
这是镜像的问题,解决方法是安装 `VCLibs` 库
|
||||
- Windows (Vista ~ 11)
|
||||
- Windows Server (2008 ~ 2022)
|
||||
- Windows Server Essentials
|
||||
- Windows Server (Semi) Annual Channel
|
||||
- Hyper-V Server
|
||||
- Azure Stack HCI
|
||||
|
||||
<https://www.google.com/search?q=ltsc+wsappx>
|
||||
#### 脚本会按需安装以下驱动
|
||||
|
||||
9. 以下网站可找到 iso 链接
|
||||
- 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 网卡](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/enhanced-networking-ena.html)、[NVME 存储控制器](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/aws-nvme-drivers.html))
|
||||
- GCP ([gVNIC 网卡](https://cloud.google.com/compute/docs/networking/using-gvnic)、[GGA 显卡](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display))
|
||||
- Azure ([MANA 网卡](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows))
|
||||
|
||||
<https://massgrave.dev/genuine-installation-media.html> (推荐,iso 来自官方,每月更新,包含最新补丁)
|
||||
> [!WARNING]
|
||||
> Vista (Server 2008) 和 32 位系统可能会缺少驱动
|
||||
|
||||
<https://www.microsoft.com/software-download/windows8>
|
||||
> [!WARNING]
|
||||
> 未开启 CSM 的 EFI 机器,无法安装 Windows 7 (Server 2008 R2)
|
||||
|
||||
<https://www.microsoft.com/software-download/windows10> (需用手机 User-Agent 打开)
|
||||
> [!WARNING]
|
||||
> 支持 ARM 机器安装 Windows 11,仅限于 Hyper-V (Azure) ,不支持 KVM (甲骨文云)
|
||||
|
||||
<https://www.microsoft.com/software-download/windows11>
|
||||
|
||||
## 虚拟化要求
|
||||
|
||||
不支持 OpenVZ、LXC 虚拟机
|
||||
|
||||
请使用 <https://github.com/LloydAsp/OsMutation>
|
||||
|
||||
## 默认密码
|
||||
|
||||
| 系统 | 用户名 | 密码 |
|
||||
| ------------- | ------------- | -------- |
|
||||
| Linux | root | 123@@@ |
|
||||
| Windows (iso) | administrator | 123@@@ |
|
||||
| Windows (dd) | 镜像用户名 | 镜像密码 |
|
||||
|
||||
如果远程登录 Windows 提示密码错误,尝试用户名 `.\administrator`
|
||||
|
||||
## 如果 Windows 下无法下载脚本
|
||||
|
||||
可尝试以下几种方法
|
||||
|
||||
1. 关闭 Windows Defender 实时保护
|
||||
|
||||
2. Windows 7 安装此补丁启用 TLS 1.2
|
||||
|
||||
<https://aka.ms/easyfix51044>
|
||||
|
||||
3. 更新 SSL 根证书
|
||||
|
||||
```batch
|
||||
certutil -generateSSTFromWU root.sst
|
||||
certutil -addstore Root root.sst
|
||||
```
|
||||
|
||||
4. 手动下载,通过 `远程桌面` 复制这两个文件
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat>
|
||||
|
||||
<https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh>
|
||||
> [!WARNING]
|
||||
> Windows 10 LTSC 2021 中文版镜像 `zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso` 的 `wsappx` 进程会长期占用 CPU
|
||||
>
|
||||
> 解决方法是更新系统补丁,或者手动安装 `VCLibs` 库 <https://www.google.com/search?q=ltsc+wsappx>
|
||||
|
||||
## 感谢
|
||||
|
||||
|
||||
Reference in New Issue
Block a user