diff --git a/.github/workflows/run_reinstall.yml b/.github/workflows/run_reinstall.yml index fa37acd..f9a00c0 100644 --- a/.github/workflows/run_reinstall.yml +++ b/.github/workflows/run_reinstall.yml @@ -22,12 +22,13 @@ jobs: git config --global core.autocrlf false - uses: actions/checkout@v4 - run: | - ${{ matrix.command }} centos 7 + ${{ matrix.command }} centos ${{ matrix.command }} alma-8 ${{ matrix.command }} rocky 9 ${{ matrix.command }} fedora ${{ matrix.command }} ubuntu ${{ matrix.command }} debian + ${{ matrix.command }} debian --ci ${{ matrix.command }} kali ${{ matrix.command }} alpine ${{ matrix.command }} opensuse @@ -36,6 +37,7 @@ jobs: ${{ matrix.command }} netboot.xyz ${{ matrix.command }} dd --img=https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-SelfInstall.raw.xz + ${{ matrix.command }} windows --image-name='Windows 11 Pro' # 测试失败例子 # ${{ matrix.command }} wrong-os diff --git a/README.en.md b/README.en.md index ca20c1f..5e2d7b8 100644 --- a/README.en.md +++ b/README.en.md @@ -11,7 +11,7 @@ Reinstall server with one-click [中文](README.md) ## Highlights -- Support installation of 12 common Linux distributions. +- Support installation of 13 common Linux distributions. - Support for installing Windows using the official original ISO. The script can automatically search for the ISO and drivers. - Support reinstallation in any direction, meaning `Linux to Linux`, `Linux to Win`, `Win to Win`, `Win to Linux`. - Specifically tailored for low-spec machines, addressing insufficient memory that prevents network installation. @@ -22,23 +22,21 @@ Reinstall server with one-click [中文](README.md) ## System Requirements -| Target System | Version | Memory | Disk | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ---------------------- | -| Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB | -| Debian | 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ | -| Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ | -| Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB | -| CentOS | 7, 9 (stream) | 512 MB \* | 5 GB | -| Oracle | 7, 8, 9 | 512 MB \* | 5 GB | -| Alma | 8, 9 | 512 MB \* | 5 GB | -| Rocky | 8, 9 | 512 MB \* | 5 GB | -| Fedora | 39, 40 | 512 MB \* | 5 GB | -| openSUSE | 15.5, 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB | -| Arch | Rolling | 512 MB | 5 GB | -| Gentoo | Rolling | 512 MB | 5 GB | -| Windows (DD) | Any | 512 MB | Depending on the image | -| Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB | -| Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB | +| Target System | Version | Memory | Disk | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ---------------------- | +| Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB | +| Debian | 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ | +| Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ | +| Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB | +| CentOS | 9 | 512 MB \* | 5 GB | +| RedHat   Alma   Rocky   Oracle | 8, 9 | 512 MB \* | 5 GB | +| Fedora | 39, 40 | 512 MB \* | 5 GB | +| openSUSE | 15.5, 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB | +| Arch | Rolling | 512 MB | 5 GB | +| Gentoo | Rolling | 512 MB | 5 GB | +| Windows (DD) | Any | 512 MB | Depending on the image | +| Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB | +| Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB | (\*) Indicates installation using cloud images, not traditional network installation. @@ -136,13 +134,19 @@ certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubuserco > > When installing other systems, can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console). +> [!IMPORTANT] +> To install Red Hat, you need to provide the `qcow2` image link obtained from the following website. +> +> See + ```bash -bash reinstall.sh centos 7|9 (9 is stream version) - oracle 7|8|9 +bash reinstall.sh centos 9 alma 8|9 rocky 8|9 + oracle 8|9 + redhat 8|9 --img 'https://xxx.qcow2' fedora 39|40 - debian 10|11|12 + debian 11|12 ubuntu 20.04|22.04|24.04 alpine 3.17|3.18|3.19|3.20 opensuse 15.5|15.6|tumbleweed @@ -252,10 +256,10 @@ Use `Dism++` File menu > Open Image File, select the iso to be installed to get - Windows (Vista ~ 11) - Windows Server (2008 ~ 2025) - - Windows Server Essentials * - - Windows Server (Semi) Annual Channel * - - Hyper-V Server * - - Azure Stack HCI * + - Windows Server Essentials \* + - Windows Server (Semi) Annual Channel \* + - Hyper-V Server \* + - Azure Stack HCI \* \* Must specify an ISO link. diff --git a/README.md b/README.md index 23a257f..f5571fb 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## 亮点 -- 支持安装 12 种常见 Linux 发行版 +- 支持安装 13 种常见 Linux 发行版 - 支持用官方原版 iso 安装 Windows,并且脚本会自动查找 iso 和驱动 - 支持任意方向重装,也就是支持 `Linux to Linux`、`Linux to Win`、`Win to Win`、`Win to Linux` - 专门适配低配小鸡,解决内存过少导致无法进行网络安装 @@ -22,23 +22,21 @@ ## 配置要求 -| 目标系统 | 版本 | 内存 | 硬盘 | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ------------ | -| Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB | -| Debian | 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ | -| Kali | 滚动 | 256 MB | 1 ~ 1.5 GB ^ | -| Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB | -| CentOS | 7, 9 (stream) | 512 MB \* | 5 GB | -| Oracle | 7, 8, 9 | 512 MB \* | 5 GB | -| Alma | 8, 9 | 512 MB \* | 5 GB | -| Rocky | 8, 9 | 512 MB \* | 5 GB | -| Fedora | 39, 40 | 512 MB \* | 5 GB | -| openSUSE | 15.5, 15.6, Tumbleweed (滚动) | 512 MB \* | 5 GB | -| Arch | 滚动 | 512 MB | 5 GB | -| Gentoo | 滚动 | 512 MB | 5 GB | -| Windows (DD) | 任何 | 512 MB | 取决于镜像 | -| Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB | -| Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB | +| 目标系统 | 版本 | 内存 | 硬盘 | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ------------ | +| Alpine | 3.17, 3.18, 3.19, 3.20 | 256 MB | 1 GB | +| Debian | 11, 12 | 256 MB | 1 ~ 1.5 GB ^ | +| Kali | 滚动 | 256 MB | 1 ~ 1.5 GB ^ | +| Ubuntu | 20.04, 22.04, 24.04 | 512 MB \* | 2 GB | +| CentOS | 9 | 512 MB \* | 5 GB | +| RedHat   Alma   Rocky   Oracle | 8, 9 | 512 MB \* | 5 GB | +| Fedora | 39, 40 | 512 MB \* | 5 GB | +| openSUSE | 15.5, 15.6, Tumbleweed (滚动) | 512 MB \* | 5 GB | +| Arch | 滚动 | 512 MB | 5 GB | +| Gentoo | 滚动 | 512 MB | 5 GB | +| Windows (DD) | 任何 | 512 MB | 取决于镜像 | +| Windows (ISO) | Vista, 7, 8.x (Server 2008 ~ 2012 R2) | 512 MB | 25 GB | +| Windows (ISO) | 10, 11 (Server 2016 ~ 2025) | 1 GB | 25 GB | (\*) 表示使用云镜像安装,非传统网络安装 @@ -136,13 +134,19 @@ certutil -urlcache -f -split https://mirror.ghproxy.com/https://raw.githubuserco > > 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。 +> [!IMPORTANT] +> 安装 Red Hat 需填写以下网站得到的 `qcow2` 镜像链接 +> +> + ```bash -bash reinstall.sh centos 7|9 (9 为 stream 版本) - oracle 7|8|9 +bash reinstall.sh centos 9 alma 8|9 rocky 8|9 + oracle 8|9 + redhat 8|9 --img 'https://xxx.qcow2' fedora 39|40 - debian 10|11|12 + debian 11|12 ubuntu 20.04|22.04|24.04 alpine 3.17|3.18|3.19|3.20 opensuse 15.5|15.6|tumbleweed @@ -252,10 +256,10 @@ Windows Server 2022 SERVERDATACENTER - Windows (Vista ~ 11) - Windows Server (2008 ~ 2025) - - Windows Server Essentials * - - Windows Server (Semi) Annual Channel * - - Hyper-V Server * - - Azure Stack HCI * + - Windows Server Essentials \* + - Windows Server (Semi) Annual Channel \* + - Hyper-V Server \* + - Azure Stack HCI \* \* 需填写 iso 链接 diff --git a/cloud-init-fix-onlink.sh b/cloud-init-fix-onlink.sh index 6346dce..0d6a5c8 100644 --- a/cloud-init-fix-onlink.sh +++ b/cloud-init-fix-onlink.sh @@ -70,8 +70,7 @@ ${spaces}routes: EOF # 网关条目 for gateway in $gateways; do - - # debian 10 的 cloud-init 不支持 to: default + # debian 11 的 netplan 不支持 to: default case $gateway in *.*) to='0.0.0.0/0' ;; *:*) to='::/0' ;; @@ -82,7 +81,6 @@ ${spaces} - to: $to ${spaces} via: $gateway ${spaces} on-link: true EOF - done } | insert_into_file $conf before 'match:' @@ -189,7 +187,7 @@ fix_wicked_conf() { systemctl restart wicked } -# debian 10/11/12: netplan + networkd/resolved +# debian 11/12: netplan + networkd/resolved # 23.1.1 修复 fix_netplan_conf diff --git a/debian.cfg b/debian.cfg index 99c319f..580e7ce 100644 --- a/debian.cfg +++ b/debian.cfg @@ -157,7 +157,6 @@ d-i partman/early_command string true; \ true >/bin/os-prober -# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹 # kali ssh 默认关闭 # 另一种方法处理 cloudcone # if [ "$link_grub_dir" = 1 ]; then mkdir /target/boot/grub2; echo 'chainloader (hd0)+1' >/target/boot/grub2/grub.cfg; fi; \ @@ -166,5 +165,4 @@ d-i preseed/late_command string true; \ if [ "$link_grub_dir" = 1 ]; then ln -s grub /target/boot/grub2; fi; \ in-target systemctl enable ssh; \ - echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf || \ - echo "PermitRootLogin yes" >>/target/etc/ssh/sshd_config + echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf diff --git a/reinstall.sh b/reinstall.sh index 1549a18..9d9b95c 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -30,22 +30,22 @@ usage_and_exit() { reinstall____='./reinstall.sh' fi cat <>/os/etc/yum.conf - fi - fi - # 删除云镜像自带的 dhcp 配置,防止歧义 # clout-init 网络配置在 /etc/sysconfig/network-scripts/ rm -rf /os/etc/NetworkManager/system-connections/*.nmconnection rm -rf /os/etc/sysconfig/network-scripts/ifcfg-* - # 为 centos 7 ci 安装 NetworkManager - # 1. 能够自动配置 onlink 网关 - # 2. 解决 cloud-init 关闭了 ra,因为 nm 无视内核 ra 设置 - if grep -E 'centos:7|oracle:linux:7' /os/etc/system-release-cpe; then - yum install -y NetworkManager - chroot /os/ systemctl enable NetworkManager - fi - # 修复 cloud-init 添加了 IPV*_FAILURE_FATAL # 甲骨文 dhcp6 获取不到 IP 将视为 fatal,原有的 ipv4 地址也会被删除 insert_into_file $ci_file after '^runcmd:' <