Code Monkey home page Code Monkey logo

reinstall's Introduction

reinstall

Codacy CodeFactor Lines of Code

一键重装脚本 English

亮点

  • 支持安装 17 种常见 Linux 发行版
  • 支持安装官方原版 Windows iso,自动查找 iso 链接、集成虚拟机驱动
  • 支持任意方向重装,即 Linux to LinuxLinux to WindowsWindows to WindowsWindows to Linux
  • 无需填写 IP 参数,自动识别动静态,支持 /32/128网关不在子网范围内纯 IPv6双网卡 等特殊网络
  • 专门适配低配小鸡,比官方 netboot 需要更少的内存
  • 全程用分区表 ID 识别硬盘,确保不会写错硬盘
  • 支持 BIOS、EFI 引导,支持 ARM
  • 不含自制包,所有资源均实时从源站点获得
  • 有很多注释

配置要求

目标系统 版本 内存 硬盘
Alpine 3.17, 3.18, 3.19, 3.20 256 MB 1 GB
Debian 9, 10, 11, 12 256 MB 1 ~ 1.5 GB ^
Kali 滚动 256 MB 1 ~ 1.5 GB ^
Ubuntu 16.04, 18.04, 20.04, 22.04, 24.04 512 MB * 2 GB
CentOS 9 512 MB * 5 GB
Anolis 7, 8 512 MB * 5 GB
RedHat   Alma   Rocky 8, 9 512 MB * 5 GB
OpenCloudOS 8, 9 512 MB * 5 GB
Oracle 7, 8, 9 512 MB * 5 GB
Fedora 39, 40 512 MB * 5 GB
openEuler 20.03, 22.03, 24.03 512 MB * 5 GB
openSUSE 15.5, 15.6, Tumbleweed (滚动) 512 MB * 5 GB
NixOS 24.05 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

(*) 表示使用云镜像安装,非传统网络安装

(^) 需要 256 MB 内存 + 1.5 GB 硬盘,或 512 MB 内存 + 1 GB 硬盘

Warning

❌ 本脚本不支持 OpenVZ、LXC 虚拟机

请改用 https://github.com/LloydAsp/OsMutation

下载(当前系统是 Linux)

国外服务器:

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

国内服务器:

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

下载(当前系统是 Windows)

Important

请先关闭 Windows Defender实时保护 功能。该功能会阻止 certutil 下载任何文件。

😢还是无法下载?

可尝试以下几种方法

  1. Windows 7 安装此补丁启用 TLS 1.2

    https://aka.ms/easyfix51044

  2. 更新 SSL 根证书

    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

国外服务器:

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

国内服务器:

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

使用

所有功能 都可在 Linux / Windows 下运行

  • Linux 下运行 bash reinstall.sh
  • Windows 下运行 reinstall.bat

功能 1: 安装 Linux

  • 不输入版本号,则安装最新版
  • 不含 boot 分区(Fedora 例外),不含 swap 分区,最大化利用磁盘空间
  • 在虚拟机上,会自动安装合适的官方精简内核
  • 安装 Red Hat 需填写 https://access.redhat.com/downloads/content/rhel 得到的 qcow2 镜像链接
  • 用户名 root 密码 123@@@,可能首次开机几分钟后密码才生效
bash reinstall.sh centos      9
                  anolis      7|8
                  alma        8|9
                  rocky       8|9
                  redhat      8|9   --img='http://xxx.com/xxx.qcow2'
                  opencloudos 8|9
                  oracle      7|8|9
                  fedora      39|40
                  nixos       24.05
                  debian      9|10|11|12
                  openeuler   20.03|22.03|24.03
                  alpine      3.17|3.18|3.19|3.20
                  opensuse    15.5|15.6|tumbleweed
                  ubuntu      16.04|18.04|20.04|22.04|24.04 [--minimal]
                  kali
                  arch
                  gentoo

Tip

安装 Debian / Kali 时,x86 可通过后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。

安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。 即使安装过程出错,也能通过 SSH 安装到 Alpine。

功能 2: DD

  • 支持 rawvhdgzipxz 格式的镜像
  • DD Windows 镜像时,会自动扩展系统盘。静态的机器会自动配置好 IP,可能首次开机几分钟后才生效
bash reinstall.sh dd --img https://example.com/xxx.xz

Tip

可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。 即使安装过程出错,也能通过 SSH 安装到 Alpine。

功能 3: 重启到 Alpine 救援系统 (Live OS)

  • 可用 ssh 连接,进行手动 DD、修改分区、手动安装 Alpine / Arch / Gentoo 等操作
  • 用户名 root 密码 123@@@
  • 如果没有修改硬盘内容,再次重启将回到原系统
bash reinstall.sh alpine --hold=1

功能 4: 重启到 netboot.xyz

  • 可使用商家后台 VNC 安装 更多系统
  • 如果没有修改硬盘内容,再次重启将回到原系统
bash reinstall.sh netboot.xyz

netboot.xyz

功能 5: 安装 Windows ISO

  • 用户名 administrator 密码 123@@@
  • 如果远程登录失败,尝试使用用户名 .\administrator
  • 静态机器会自动配置好 IP,可能首次开机几分钟后才生效

方法 1: 让脚本自动查找 ISO

bash reinstall.sh windows \
     --image-name 'Windows 10 Enterprise LTSC 2021' \
     --lang zh-cn

方法 2: 自行指定 ISO 连接

  • 如果不知道 --image-name,可以随便填,重启后连接 SSH ,根据错误提示重新输入
bash reinstall.sh windows \
     --image-name 'Windows 10 Enterprise LTSC 2021' \
     --iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso'

Important

注意参数两边有引号。

以下网站可找到 iso 链接

Installing Windows

参数说明

--image-name 指定要安装的映像,不区分大小写,常用映像有:

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

使用 Dism++ 文件菜单 > 打开映像文件,选择要安装的 iso,可以得到映像名称

image-name

支持的系统

  • Windows (Vista ~ 11)
  • Windows Server (2008 ~ 2025)
    • Windows Server Essentials *
    • Windows Server (Semi) Annual Channel *
    • Hyper-V Server *
    • Azure Stack HCI *

* 需填写 iso 链接

脚本会按需安装以下驱动

Warning

Vista (Server 2008) 和 32 位系统可能会缺少驱动

Warning

未开启 CSM 的 EFI 机器,无法安装 Windows 7 (Server 2008 R2)

Warning

支持 ARM 机器安装 Windows 11,仅限于 Hyper-V (Azure) ,不支持 KVM (甲骨文云)

Warning

Windows 10 LTSC 2021 中文版镜像 zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.isowsappx 进程会长期占用 CPU

解决方法是更新系统补丁,或者手动安装 VCLibshttps://www.google.com/search?q=ltsc+wsappx

如何修改脚本

  1. Fork 本仓库
  2. 修改 reinstall.shreinstall.bat 开头的 confhomeconfhome_cn
  3. 修改其它代码

感谢

感谢以下商家提供白嫖机器

Oracle Cloud DartNode

reinstall's People

Contributors

bin456789 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.