core: 重新启用 github 代理

极狐 jihulab SAAS 需要付费
This commit is contained in:
bin456789 2024-10-18 01:02:54 +08:00
parent 7b02e3ab31
commit bb2c0b94a7
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
4 changed files with 216 additions and 182 deletions

View File

@ -14,8 +14,8 @@ One-Click Script to Reinstall System [中文](README.md)
## Highlights
- Supports installation of 17 common Linux distributions
- Supports installation of official Windows ISO, automatically finds ISO links, and integrates virtual machine drivers
- Supports one-click installation of Linux: allows install 17 common distributions.
- Supports one-click Windows installation: Uses the official ISO for installation instead of custom images. The script automatically retrieves the ISO link and installs `Virtio` and other drivers.
- Supports installation in any direction, i.e., `Linux to Linux`, `Linux to Windows`, `Windows to Windows`, `Windows to Linux`
- No need to input IP parameters; automatically recognizes dynamic and static IPs, supports `/32`, `/128`, `gateway outside subnet`, `IPv6 only`, `dual NIC` and other special network configurations
- Specially optimized for low-spec servers, requires less memory than the official netboot
@ -26,6 +26,10 @@ One-Click Script to Reinstall System [中文](README.md)
## System Requirements
The original system can be any system listed in the table.
The system requirements for the target system are as follows:
| 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 |
@ -47,9 +51,9 @@ One-Click Script to Reinstall System [中文](README.md)
| <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 ~ 2025) | 1 GB | 25 GB |
(\*) Indicates installation using cloud images, not traditional network installation.
\* Indicates installation using cloud images, not traditional network installation.
(^) indicates requiring either 256 MB memory + 1.5 GB disk, or 512 MB memory + 1 GB disk
^ Indicates requiring either 256 MB memory + 1.5 GB disk, or 512 MB memory + 1 GB disk
> [!WARNING]
> ❌ This script does not support OpenVZ or LXC virtual machines.
@ -67,7 +71,7 @@ curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
For server inside China:
```bash
curl -O https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh || wget -O reinstall.sh $_
curl -O https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_
```
## 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)
@ -109,7 +113,7 @@ certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinsta
For server inside China:
```batch
certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.bat
certutil -urlcache -f -split https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
```
## Usage
@ -117,21 +121,16 @@ certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/
**All features** can be used on both Linux and Windows.
- on Linux, execute `bash reinstall.sh`
- on Windows, execute `reinstall.bat`
- on Windows, execute `.\reinstall.bat`
### Feature 1: Install <img width="16" height="16" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux
- If no version number is entered, the latest version will be installed.
- Does not include a boot partition (except for Fedora), nor a swap partition, maximizing disk space utilization.
- On virtual machines, the appropriate official slimmed-down kernel will be automatically installed.
- To install Red Hat, you need to provide the `qcow2` image link obtained from <https://access.redhat.com/downloads/content/rhel>.
- Username `root`, Default password `123@@@`. It may take a few minutes for the password to take effect on the first boot.
- After reinstalling, if you need to change SSH port or switch to key-based login, be sure to modify the files inside `/etc/ssh/sshd_config.d/`.
- Optional parameters:
- `--password PASSWORD` Set password
- `--ssh-port PORT` Change SSH port (for both the target system and log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--hold 2` Prevent entering the system after installation. You can connect via SSH to modify system content, with the system mounted at `/os` (this feature is not supported on Debian/Kali).
- The username is `root` with a default password of `123@@@`. It may take a few minutes after the first boot to successfully log in.
- When installing the latest version, the version number does not need to be specified.
- Maximizes disk space usage: no boot partition (except for Fedora) and no swap partition.
- Automatically selects different optimized kernels based on machine type, such as `Cloud` or `HWE` kernels.
- When installing Red Hat, you must provide the `qcow2` image link obtained from <https://access.redhat.com/downloads/content/rhel>.
- After reinstallation, if you need to change the SSH port or switch to key-based login, make sure to also modify the files inside `/etc/ssh/sshd_config.d/`.
```bash
bash reinstall.sh centos 9
@ -153,37 +152,44 @@ bash reinstall.sh centos 9
gentoo
```
#### Optional Parameters
- `--password PASSWORD` Set the password
- `--ssh-port PORT` Change the SSH port (for log observation during installation and for the new system)
- `--web-port PORT` Change the Web port (for log observation during installation)
- `--hold 2` Prevent reboot after installation completes, allowing SSH login to modify system content; the system is mounted at `/os` (this feature is not supported on Debian/Kali).
> [!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).
> Even if errors occur during the installation process, you can still install Alpine via SSH by running `xda=drive_name /trans.sh alpine`
> <br />Even if errors occur during the installation process, you can still install to Alpine via SSH by running `xda=drive_name /trans.sh alpine`
<details>
<summary>Experimental Features</summary>
Install Debian using a cloud image, suitable for machines with slower CPUs
Install Debian using a cloud image
- Suitable for machines with slower CPUs
```bash
bash reinstall.sh debian --ci
```
Install CentOS, Alma, Rocky, Fedora using ISO, only supports machines with more than 2G of memory and dynamic IP.
Install CentOS, Alma, Rocky, Fedora using ISO
Password `123@@@`, SSH Port `22`
Password and SSH port options are not supported.
- Only supports machines with more than 2G of memory and dynamic IP.
- Password is `123@@@`, and the SSH port is `22`; modifying them using parameters is not supported.
```bash
bash reinstall.sh centos --installer
```
Install Ubuntu using ISO, only supports machines with more than 1G of memory and dynamic IP.
Install Ubuntu using ISO
Password `123@@@`, SSH Port `22`
Password and SSH port options are not supported.
- Only supports machines with more than 1G of memory and dynamic IP.
- Password is `123@@@`, and the SSH port is `22`; modifying them using parameters is not supported.
```bash
bash reinstall.sh ubuntu --installer
@ -194,40 +200,44 @@ bash reinstall.sh ubuntu --installer
### Feature 2: DD
- Supports `raw`, `vhd` images or those compressed with `xz` or `gzip`.
- When deploy a Windows image, the system disk will be expanded, and machines with static IPs will have their IPs configured. However, it may take a few minutes after the first boot for the configuration to take effect.
- When deploy a Linux image, the script will not modify any contents of the image.
- Optional parameters:
- `--allow-ping` Allow ping responses (Windows only)
- `--rdp-port PORT` Change RDP port (DD Windows only)
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--hold 2` Prevent entering the system after DD completion. You can connect via SSH to modify system content, with the system mounted at `/os`.
- When deploy a Windows image, the system disk will be automatically expanded, and machines with a static IP will have their IP configured, and may take a few minutes after the first boot for the configuration to take effect.
- When deploy a Linux image, will **NOT** modify any contents of the image.
```bash
bash reinstall.sh dd --img https://example.com/xxx.xz
```
#### Optional parameters
- `--allow-ping` Allow ping responses (DD Windows only)
- `--rdp-port PORT` Change RDP port (DD Windows only)
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--hold 2` Prevent entering the system after DD completion. You can connect via SSH to modify system content, with the system mounted at `/os`.
> [!TIP]
> Can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console).
> Even if errors occur during the installation process, you can still install Alpine via SSH by running `xda=drive_name /trans.sh alpine`
> <br />Even if errors occur during the installation process, you can still install to Alpine via SSH by running `xda=drive_name /trans.sh alpine`
### Feature 3: Reboot to <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Rescue System (Live OS)
- You can use SSH to manually perform DD operations, modify partitions, and manually install Alpine, Arch, Gentoo, and other systems.
- You can use SSH to backup/restore disk, manually perform DD operations, modify partitions, and manually install Alpine, Arch, Gentoo, and other systems.
- Username `root`, Default password `123@@@`
- If the disk content is not modified, rebooting again will return to the original system.
- Optional parameters:
- `--password PASSWORD` Set password
- `--ssh-port PORT` Change SSH port
- If manual operations do not damage the original system, rebooting will return to the original system.
```bash
bash reinstall.sh alpine --hold=1
```
#### Optional parameters
- `--password PASSWORD` Set password
- `--ssh-port PORT` Change SSH port
### Feature 4: Reboot to <img width="16" height="16" src="https://netboot.xyz/img/favicon.ico" /> netboot.xyz
- 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.
- If the disk content is not modified, rebooting again will return to the original system.
- Can manually 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.
- If manual operations do not damage the original system, rebooting will return to the original system.
```bash
bash reinstall.sh netboot.xyz
@ -237,23 +247,27 @@ bash reinstall.sh netboot.xyz
### 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
![Windows Installation](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)
- Username `administrator`, Default password `123@@@`
- If remote login fails, try using the username `.\administrator`.
- The machine with a static IP will automatically configure the IP. It may take a few minutes to take effect on the first boot.
- Optional parameters:
- `--password PASSWORD` Set Password
- `--allow-ping` Allow ping responses
- `--rdp-port PORT` Change RDP port
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--hold 2` Allow SSH connections for modifying the hard disk content before rebooting into the official Windows installation program, with the hard disk mounted at `/os`.
- Supports all languages.
![Windows Installation](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)
#### 支持的系统
#### Method 1: Allow the script to automatically find the ISO
- Windows (Vista ~ 11)
- Windows Server (2008 ~ 2025)
- Windows Server Essentials \*
- Windows Server (Semi) Annual Channel \*
- Hyper-V Server \*
- Azure Stack HCI \*
- The script will search for ISO files from <https://massgrave.dev/genuine-installation-media.html>. The ISOs provided on this site are all official versions.
- Only supports automatic detection of standard Windows and Windows Server versions.
#### Method 1: Let the Script Automatically Search for ISO (Recommended)
- Typically, Windows releases new official ISOs every month, which integrate the latest system patches, avoiding the need to download a bunch of updates right after installation.
- The script will search for ISOs from <https://massgrave.dev/genuine-installation-media.html>, a site that collects monthly released ISOs, ensuring that the ISOs found by the script are the official latest versions.
- Systems marked with \* do not support automatic ISO searching.
```bash
bash reinstall.sh windows \
@ -310,7 +324,7 @@ zh-tw
#### Method 2: Specify the ISO link manually
- If you dont know the `--image-name`, you can enter any value. After rebooting, connect via SSH and re-enter the correct value based on the error messages.
- If you don't know the `--image-name`, you can enter any value. After rebooting, connect via SSH and re-enter the correct value based on the error messages.
```bash
bash reinstall.sh windows \
@ -318,12 +332,9 @@ bash reinstall.sh windows \
--iso 'https://drive.massgrave.dev/zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso'
```
> [!IMPORTANT]
> Note that parameters should be enclosed in quotation marks.
<details>
<summary>The following website provides iso links.</summary>
<summary>The following website provides ISO links.</summary>
- <https://massgrave.dev/genuine-installation-media.html> (Recommended, iso sourced from official channels, updated monthly, includes the latest patches)
- <https://www.microsoft.com/software-download/windows10> (Need to open it with a non-Windows User-Agent)
@ -340,9 +351,22 @@ bash reinstall.sh windows \
</details>
#### Parameters Description
#### Optional parameters
`--image-name` Specify the image to install, case-insensitive, Commonly used images include:
- `--password PASSWORD` Set Password
- `--allow-ping` Allow ping responses
- `--rdp-port PORT` Change RDP port
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
- `--hold 2` Allow SSH connections for modifying the disk content before rebooting into the official Windows installation program, with the disk mounted at `/os`.
#### How to Specify the Image Name `--image-name`
Typically, an ISO will contain multiple system versions, such as Home Edition and Professional Edition. The image name `--image-name` is used to specify the version to be installed, and it is case-insensitive when entered.
You can use tools like DISM, DISM++, or Wimlib to query the image names included in the ISO.
Commonly used image names include:
```text
Windows 7 Ultimate
@ -351,21 +375,12 @@ Windows 11 Enterprise LTSC 2024
Windows Server 2025 SERVERDATACENTER
```
Open [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) File menu > Open Image File, select the iso to be installed to get the image name (full system name), and all available image names are installable.
#### How to Use [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) to Query the Image Names Included in the ISO
Open File menu > Open Image File, select the iso to be installed to get the image name (full system name), and all available image names are installable.
![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)
#### Supported systems
- Windows (Vista ~ 11)
- Windows Server (2008 ~ 2025)
- Windows Server Essentials \*
- Windows Server (Semi) Annual Channel \*
- Hyper-V Server \*
- Azure Stack HCI \*
With * indicating that an ISO link is required.
#### The script will install the following drivers as needed
- Virtio ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/), [Alibaba Cloud](https://www.alibabacloud.com/help/ecs/user-guide/update-red-hat-virtio-drivers-of-windows-instances))
@ -388,26 +403,28 @@ With * indicating that an ISO link is required.
>
> The solution is to update the system patches or manually install the `VCLibs` library <https://www.google.com/search?q=ltsc+wsappx>.
#### ARM Considerations
#### Considerations for Installing Windows on ARM
Most ARM machines support installing Windows 11 24H2 via ISO.
Most ARM machines support installing Windows 11 24H2.
During the installation process, you might encounter a black screen, and the serial console may display `ConvertPages: failed to find range`, but neither issue affects the installation.
- ✔Azure: B2pts_v2
- ✔Alibaba Cloud: g8y, c8y, r8y (may occasionally get stuck on the boot logo during restart; force restart to resolve)
- ✔Alibaba Cloud: g6r, c6r
- ✔Oracle Cloud A1.Flex (Success depends on the machine's creation date; newer instances are more likely to install successfully. You will also need to manually load the GPU drivers after installation.)
- ✔AWS: T4g
- ✔Scaleway: COPARM1
- ✔Gcore
- ❌Google Cloud: t2a (lacking network card driver)
| Compatibility | Cloud Provider | Instance Type | Issues |
| ------------- | -------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ✔️ | Azure | B2pts_v2 | |
| ✔️ | Alibaba Cloud | g6r, c6r | |
| ✔️ | Alibaba Cloud | g8y, c8y, r8y | There is a chance of hanging at the boot logo during restart; forced reboot will resolve it. |
| ✔️ | AWS | T4g | |
| ✔️ | Scaleway | COPARM1 | |
| ✔️ | Gcore | | |
| ❔ | Oracle Cloud | A1.Flex | Installation success is not guaranteed; newer instances are more likely to succeed.<br />Manual loading of GPU drivers is required after installation. |
| ❌ | Google Cloud | t2a | Missing network card drivers |
<details>
<summary>Loading Graphics Driver on Oracle Cloud</summary>
No need to download the driver, just open Device Manager, find the graphics card, select 'Update driver', and choose `Red Hat VirtIO GPU DOD controller` from the list.
Log in to the server using Remote Desktop, open Device Manager, locate the graphics card, select "Update Driver," and choose `Red Hat VirtIO GPU DOD controller` from the list. There's no need to download the drivers in advance.
![virtio-gpu-1](https://github.com/user-attachments/assets/503e1d82-4fa9-4486-917e-73326ad7c988)
![virtio-gpu-2](https://github.com/user-attachments/assets/bf3a9af6-13d8-4f93-9d6c-d3b2dbddb37d)
@ -420,7 +437,7 @@ No need to download the driver, just open Device Manager, find the graphics card
[![GitHub Issues](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bin456789/reinstall/issues)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
## How to Modify the Script
## How to Modify the Script for your own
1. Fork this repository.
2. Modify the `confhome` and `confhome_cn` at the beginning of `reinstall.sh` and `reinstall.bat`.

201
README.md
View File

@ -14,8 +14,8 @@
## 亮点
- 支持安装 17 种常见 Linux 发行版
- 支持安装官方原版 Windows iso自动查找 iso 链接、集成虚拟机驱动
- 支持一键安装 Linux安装 17 种常见发行版
- 支持一键安装 Windows使用官方 ISO 安装而非自制镜像,脚本会自动获取 ISO 链接、自动安装 Virtio 等驱动
- 支持任意方向重装,即 `Linux to Linux``Linux to Windows``Windows to Windows``Windows to Linux`
- 无需填写 IP 参数,自动识别动静态,支持 `/32``/128``网关不在子网范围内``纯 IPv6``双网卡` 等特殊网络
- 专门适配低配小鸡,比官方 netboot 需要更少的内存
@ -24,7 +24,11 @@
- 不含自制包,所有资源均实时从源站点获得
- 有很多注释
## 配置要求
## 系统要求
原系统可以是表格中的任意系统
目标系统的配置要求如下:
| 目标系统 | 版本 | 内存 | 硬盘 |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ------------ |
@ -47,9 +51,9 @@
| <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 ~ 2025) | 1 GB | 25 GB |
(\*) 表示使用云镜像安装,非传统网络安装
\* 表示使用云镜像安装,非传统网络安装
(^) 需要 256 MB 内存 + 1.5 GB 硬盘,或 512 MB 内存 + 1 GB 硬盘
^ 表示需要 256 MB 内存 + 1.5 GB 硬盘,或 512 MB 内存 + 1 GB 硬盘
> [!WARNING]
> ❌ 本脚本不支持 OpenVZ、LXC 虚拟机
@ -67,7 +71,7 @@ curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh
国内服务器:
```bash
curl -O https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.sh || wget -O reinstall.sh $_
curl -O https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_
```
## 下载(当前系统是 <img width="20" height="20" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows
@ -109,7 +113,7 @@ certutil -urlcache -f -split https://raw.githubusercontent.com/bin456789/reinsta
国内服务器:
```batch
certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/reinstall.bat
certutil -urlcache -f -split https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat
```
## 使用
@ -117,21 +121,16 @@ certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/
**所有功能** 都可在 Linux / Windows 下运行
- Linux 下运行 `bash reinstall.sh`
- Windows 下运行 `reinstall.bat`
- Windows 下运行 `.\reinstall.bat`
### 功能 1: 安装 <img width="16" height="16" src="https://www.kernel.org/theme/images/logos/favicon.png" /> Linux
- 不输入版本号,则安装最新版
- 不含 boot 分区Fedora 例外),不含 swap 分区,最大化利用磁盘空间
- 在虚拟机上,会自动安装合适的官方精简内核
- 安装 Red Hat 需填写 <https://access.redhat.com/downloads/content/rhel> 得到的 `qcow2` 镜像链接
- 用户名 `root` 默认密码 `123@@@`,密码可能首次开机几分钟后才生效
- 重装后如需修改 SSH 端口 / 改成密钥登录,还要注意修改 `/etc/ssh/sshd_config.d/` 里面的文件
- 可选参数
- `--password PASSWORD` 设置密码
- `--ssh-port PORT` 修改 SSH 端口(目标系统 + 安装期间观察日志)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志)
- `--hold 2` 安装结束后不进入系统。可连接 SSH 修改系统内容,系统挂载在 `/os` (此功能不支持 Debian / Kali)
- 用户名 `root` 默认密码 `123@@@`,首次开机可能要等几分钟才能成功登录
- 安装最新版可不输入版本号
- 最大化利用磁盘空间:不含 boot 分区Fedora 例外),不含 swap 分区
- 自动根据机器类型选择不同的优化内核,例如 `Cloud``HWE` 内核
- 安装 Red Hat 时需填写 <https://access.redhat.com/downloads/content/rhel> 得到的 `qcow2` 镜像链接
- 重装后如需修改 SSH 端口或者改成密钥登录,注意还要修改 `/etc/ssh/sshd_config.d/` 里面的文件
```bash
bash reinstall.sh centos 9
@ -153,37 +152,44 @@ bash reinstall.sh centos 9
gentoo
```
#### 可选参数
- `--password PASSWORD` 设置密码
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用,也用于新系统)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
- `--hold 2` 安装结束后不重启,此时可以 SSH 登录修改系统内容,系统挂载在 `/os` (此功能不支持 Debian / Kali)
> [!TIP]
> 安装 Debian / Kali 时x86 可通过后台 VNC 查看安装进度ARM 可通过串行控制台查看安装进度。
>
> 安装其它系统时可通过多种方式SSH、HTTP 80 端口、后台 VNC、串行控制台查看安装进度。
> 即使安装过程出错,也能通过 SSH 运行 `xda=硬盘名 /trans.sh alpine` 安装 Alpine。
> <br />即使安装过程出错,也能通过 SSH 运行 `xda=硬盘名 /trans.sh alpine` 安装 Alpine。
<details>
<summary>实验性功能</summary>
用云镜像安装 Debian适合于 CPU 较慢的机器
云镜像安装 Debian
- 适合于 CPU 较慢的机器
```bash
bash reinstall.sh debian --ci
```
ISO 安装 CentOS, Alma, Rocky, Fedora ,仅支持内存大于 2G 且为动态 IP 的机器
ISO 安装 CentOS, Alma, Rocky, Fedora
密码 `123@@@`SSH 端口 `22`
不支持设置密码、SSH 端口等选项
- 仅支持内存大于 2G 且为动态 IP 的机器
- 密码 `123@@@`SSH 端口 `22`,不支持用参数修改
```bash
bash reinstall.sh centos --installer
```
ISO 安装 Ubuntu ,仅支持内存大于 1G 且为动态 IP 的机器
ISO 安装 Ubuntu
密码 `123@@@`SSH 端口 `22`
不支持设置密码、SSH 端口等选项
- 仅支持内存大于 1G 且为动态 IP 的机器
- 密码 `123@@@`SSH 端口 `22`,不支持用参数修改
```bash
bash reinstall.sh ubuntu --installer
@ -194,40 +200,44 @@ bash reinstall.sh ubuntu --installer
### 功能 2: DD
- 支持 `raw` `vhd` 或者经过 `xz` `gzip` 压缩的镜像
- DD Windows 镜像时,会扩展系统盘,静态 IP 的机器会配置好 IP可能首次开机几分钟后才生效
- DD Linux 镜像时,脚本不会修改镜像的任何内容
- 可选参数
- `--allow-ping` 允许被 Ping (仅限 DD Windows)
- `--rdp-port PORT` 修改 RDP 端口 (仅限 DD Windows)
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志)
- `--hold 2` DD 结束后不进入系统。可连接 SSH 修改系统内容,系统挂载在 `/os`
- DD Windows 镜像时,会自动扩展系统盘,静态 IP 的机器会配置好 IP可能首次开机几分钟后才生效
- DD Linux 镜像时,**不会**修改镜像的任何内容
```bash
bash reinstall.sh dd --img https://example.com/xxx.xz
```
#### 可选参数
- `--allow-ping` 允许被 Ping (仅限 DD Windows)
- `--rdp-port PORT` 修改 RDP 端口 (仅限 DD Windows)
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
- `--hold 2` DD 结束后不重启,此时可以 SSH 登录修改系统内容,系统挂载在 `/os`
> [!TIP]
> 可通过多种方式SSH、HTTP 80 端口、后台 VNC、串行控制台查看安装进度。
> 即使安装过程出错,也能通过 SSH 运行 `xda=硬盘名 /trans.sh alpine` 安装 Alpine。
> <br />即使安装过程出错,也能通过 SSH 运行 `xda=硬盘名 /trans.sh alpine` 安装 Alpine。
### 功能 3: 重启到 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine 救援系统 (Live OS)
### 功能 3: 重启到 <img width="16" height="16" src="https://www.alpinelinux.org/alpine-logo.ico" /> Alpine Live OS救援系统
- 可用 ssh 连接,进行手动 DD、修改分区、手动安装 Alpine / Arch / Gentoo 等操作
- 可用 ssh 连接,进行备份/恢复硬盘、手动 DD、修改分区、手动安装 Alpine/Arch/Gentoo 等操作
- 用户名 `root` 默认密码 `123@@@`
- 如果没有修改硬盘内容,再次重启将回到原系统
- 可选参数
- `--password PASSWORD` 设置密码
- `--ssh-port PORT` 修改 SSH 端口
- 如果手动操作没有破坏原系统,再次重启将回到原系统
```bash
bash reinstall.sh alpine --hold=1
```
#### 可选参数
- `--password PASSWORD` 设置密码
- `--ssh-port PORT` 修改 SSH 端口
### 功能 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)
- 如果没有修改硬盘内容,再次重启将回到原系统
- 可使用商家后台 VNC 手动安装 [更多系统](https://github.com/netbootxyz/netboot.xyz?tab=readme-ov-file#what-operating-systems-are-currently-available-on-netbootxyz)
- 如果手动操作没有破坏原系统,再次重启将回到原系统
```bash
bash reinstall.sh netboot.xyz
@ -237,23 +247,27 @@ bash reinstall.sh netboot.xyz
### 功能 5: 安装 <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows ISO
- 用户名 `administrator` 默认密码 `123@@@`
- 如果远程登录失败,尝试使用用户名 `.\administrator`
- 静态机器会自动配置好 IP可能首次开机几分钟后才生效
- 可选参数
- `--password PASSWORD` 设置密码
- `--allow-ping` 允许被 Ping
- `--rdp-port PORT` 更改 RDP 端口
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志)
- `--hold 2` 在重启进入 Windows 官方安装程序前,可连接 SSH 修改硬盘内容,硬盘挂载在 `/os`
![Windows 安装界面](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)
#### 方法 1: 让脚本自动查找 ISO
- 用户名 `administrator` 默认密码 `123@@@`
- 如果远程登录失败,可以尝试使用用户名 `.\administrator`
- 静态机器会自动配置好 IP可能首次开机几分钟后才生效
- 支持所有语言
- 脚本会从 <https://massgrave.dev/genuine-installation-media.html> 查找 iso该网站提供的 iso 都是官方原版
- 仅支持自动查找常规 Windows 和 Windows Server 版本
#### 支持的系统
- Windows (Vista ~ 11)
- Windows Server (2008 ~ 2025)
- Windows Server Essentials \*
- Windows Server (Semi) Annual Channel \*
- Hyper-V Server \*
- Azure Stack HCI \*
#### 方法 1: 让脚本自动查找 ISO (推荐)
- 通常情况下 Windows 每个月都会发布新的官方 ISO集成了最新的系统补丁避免了刚安装好系统就要下载一堆补丁
- 脚本会从 <https://massgrave.dev/genuine-installation-media.html> 查找 ISO该网站收录了每月发布的 ISO因此脚本查找到的 ISO 都是官方最新版
- 上面带 \* 的系统不支持自动查找 ISO
```bash
bash reinstall.sh windows \
@ -310,7 +324,7 @@ zh-tw
#### 方法 2: 自行指定 ISO 连接
- 如果不知道 `--image-name`,可以随便填,重启后连接 SSH ,根据错误提示重新输入
- 如果不知道 `--image-name`,可以随便填,重启后连接 SSH根据错误提示重新输入正确的值
```bash
bash reinstall.sh windows \
@ -318,12 +332,9 @@ bash reinstall.sh windows \
--iso 'https://drive.massgrave.dev/zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso'
```
> [!IMPORTANT]
> 注意参数两边有引号。
<details>
<summary>以下网站可找到 iso 链接</summary>
<summary>以下网站可找到 ISO 链接</summary>
- <https://massgrave.dev/genuine-installation-media.html> (推荐iso 来自官方,每月更新,包含最新补丁)
- <https://www.microsoft.com/software-download/windows10> (需用非 Windows User-Agent 打开)
@ -340,9 +351,22 @@ bash reinstall.sh windows \
</details>
#### 参数说明
#### 可选参数
`--image-name` 指定要安装的映像,不区分大小写,常用映像有:
- `--password PASSWORD` 设置密码
- `--allow-ping` 允许被 Ping
- `--rdp-port PORT` 更改 RDP 端口
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
- `--hold 2` 在进入 Windows 官方安装程序之前,可以 SSH 登录修改硬盘内容,硬盘挂载在 `/os`
#### 如何填写映像名称 `--image-name`
通常一个 ISO 会包含多个系统版本,例如家庭版、专业版。映像名称 `--image-name` 就是用来指定要安装的版本,填写时不区分大小写
可以用 DISM、DISM++、Wimlib 等工具查询 ISO 包含的映像名称
常用的映像名称有:
```text
Windows 7 Ultimate
@ -351,21 +375,12 @@ Windows 11 Enterprise LTSC 2024
Windows Server 2025 SERVERDATACENTER
```
打开 [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) 文件菜单 > 打开映像文件,选择要安装的 iso可以得到映像名称系统全名所有映像名称都可安装
#### 如何用 [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) 查询 ISO 包含的映像名称
打开文件菜单 > 打开映像文件,选择要安装的 iso即可得到映像名称所有映像名称都可以安装
![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)
#### 支持的系统
- Windows (Vista ~ 11)
- Windows Server (2008 ~ 2025)
- Windows Server Essentials \*
- Windows Server (Semi) Annual Channel \*
- Hyper-V Server \*
- Azure Stack HCI \*
带 \* 表示需要填写 iso 链接
#### 脚本会按需安装以下驱动
- Virtio ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/)、[阿里云](https://www.alibabacloud.com/help/ecs/user-guide/update-red-hat-virtio-drivers-of-windows-instances))
@ -388,26 +403,28 @@ Windows Server 2025 SERVERDATACENTER
>
> 解决方法是更新系统补丁,或者手动安装 `VCLibs`<https://www.google.com/search?q=ltsc+wsappx>
#### ARM 注意事项
#### ARM 安装 Windows 的注意事项
大部分 ARM 机器支持 ISO 安装 Windows 11 24H2
大部分 ARM 机器支持安装 Windows 11 24H2
安装过程可能会黑屏,串行控制台可能会显示 `ConvertPages: failed to find range`,均不影响安装
安装过程可能会黑屏,串行控制台可能会显示 `ConvertPages: failed to find range`,均不影响正常安装
- ✔Azure B2pts_v2
- ✔️阿里云 g8y c8y r8y (有几率重启时卡开机 Logo强制重启即可)
- ✔️阿里云 g6r c6r
- ✔️甲骨文云 A1.Flex (视乎机器的创建日期,越新的越有可能成功安装,安装后还需要手动加载显卡驱动)
- ✔AWS T4g
- ✔Scaleway COPARM1
- ✔Gcore
- ❌谷歌云 t2a (缺少网卡驱动)
| 兼容性 | 云服务商 | 实例类型 | 问题 |
| ------ | -------- | ------------- | ---------------------------------------------------------------------------- |
| ✔️ | Azure | B2pts_v2 | |
| ✔️ | 阿里云 | g6r, c6r | |
| ✔️ | 阿里云 | g8y, c8y, r8y | 有几率重启时卡开机 Logo强制重启即可 |
| ✔️ | AWS | T4g | |
| ✔️ | Scaleway | COPARM1 | |
| ✔️ | Gcore | | |
| ❔ | 甲骨文云 | A1.Flex | 不一定能安装成功,越新创建的实例越容易成功<br />安装后还需要手动加载显卡驱动 |
| ❌ | 谷歌云 | t2a | 缺少网卡驱动 |
<details>
<summary>甲骨文云加载显卡驱动</summary>
不需要下载驱动,只需打开设备管理器,找到显卡,选择更新驱动,在列表中选择 `Red Hat VirtIO GPU DOD controller`
使用远程桌面登录到服务器,打开设备管理器,找到显卡,选择更新驱动,在列表中选择 `Red Hat VirtIO GPU DOD controller` 即可。不需要提前下载驱动。
![virtio-gpu-1](https://github.com/user-attachments/assets/503e1d82-4fa9-4486-917e-73326ad7c988)
![virtio-gpu-2](https://github.com/user-attachments/assets/bf3a9af6-13d8-4f93-9d6c-d3b2dbddb37d)
@ -420,7 +437,7 @@ Windows Server 2025 SERVERDATACENTER
[![GitHub Issues](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/bin456789/reinstall/issues)
[![Telegram Group](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/reinstall_os)
## 如何修改脚本
## 如何修改脚本自用
1. Fork 本仓库
2. 修改 `reinstall.sh``reinstall.bat` 开头的 `confhome``confhome_cn`

View File

@ -3,8 +3,8 @@ mode con cp select=437 >nul
setlocal EnableDelayedExpansion
set confhome=https://raw.githubusercontent.com/bin456789/reinstall/main
set confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main
rem set confhome_cn=https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main
set confhome_cn=https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main
rem set confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main
rem 65001 代码页会乱码

View File

@ -4,8 +4,8 @@
set -eE
confhome=https://raw.githubusercontent.com/bin456789/reinstall/main
confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main
# confhome_cn=https://mirror.ghproxy.com/https://raw.githubusercontent.com/bin456789/reinstall/main
confhome_cn=https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main
# confhome_cn=https://jihulab.com/bin456789/reinstall/-/raw/main
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0002