Linux一键DD系统教学

sbsky112 发布于 2025-04-27 363 次阅读


省流版一键安装Debian12

curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_ && bash reinstall.sh debian12

第一步:

下载DD脚本

国外服务器

curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_

国内服务器

curl -O https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.sh || wget -O reinstall.sh $_

第二步:

选择系统并安装

系统要求

原系统可以是表格中的任意系统

目标系统的配置要求如下:

系统版本内存硬盘
 Alpine3.18, 3.19, 3.20, 3.21256 MB1 GB
 Debian9, 10, 11, 12256 MB1 ~ 1.5 GB ^
 Kali滚动256 MB1 ~ 1.5 GB ^
 Ubuntu16.04 LTS - 24.04 LTS, 25.04512 MB *2 GB
 Anolis7, 8, 23512 MB *5 GB
 RHEL   AlmaLinux   Rocky   Oracle8, 9512 MB *5 GB
 OpenCloudOS8, 9, Stream 23512 MB *5 GB
 CentOS Stream9, 10512 MB *5 GB
 Fedora41, 42512 MB *5 GB
 openEuler20.03 LTS - 24.03 LTS, 25.03512 MB *5 GB
 openSUSELeap 15.6, Tumbleweed (滚动)512 MB *5 GB
 NixOS24.11512 MB5 GB
 Arch滚动512 MB5 GB
 Gentoo滚动512 MB5 GB
 安同 OS滚动512 MB5 GB
 飞牛 fnOS公测512 MB8 GB
 Windows (DD)任何512 MB取决于镜像
 Windows (ISO)Vista, 7, 8.x (Server 2008 - 2012 R2)512 MB25 GB
 Windows (ISO)10, 11 (Server 2016 - 2025)1 GB25 GB

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

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

安装

bash reinstall.sh 你想要安装的系统+版本
                  anolis      7|8|23
                  opencloudos 8|9|23
                  rocky       8|9
                  redhat      8|9   --img="http://xxx.com/xxx.qcow2"
                  oracle      8|9
                  almalinux   8|9
                  centos      9|10
                  fedora      41|42
                  nixos       24.11
                  debian      9|10|11|12
                  opensuse    15.6|tumbleweed
                  alpine      3.18|3.19|3.20|3.21
                  openeuler   20.03|22.03|24.03|25.03
                  ubuntu      16.04|18.04|20.04|22.04|24.04|25.04 [--minimal]
                  kali
                  arch
                  gentoo
                  aosc
                  fnos

可选参数:

  • --password PASSWORD 设置密码
  • --ssh-key KEY 设置 SSH 登录公钥,支持以下格式。当使用公钥时,密码为空
    • --ssh-key "ssh-rsa ..."
    • --ssh-key "ssh-ed25519 ..."
    • --ssh-key "ecdsa-sha2-nistp256/384/521 ..."
    • --ssh-key http://path/to/public_key
    • --ssh-key github:your_username
    • --ssh-key gitlab:your_username
    • --ssh-key /path/to/public_key
    • --ssh-key C:\path\to\public_key
  • --ssh-port PORT 修改 SSH 端口(安装期间观察日志用,也作用于新系统)
  • --web-port PORT 修改 Web 端口(安装期间观察日志用)
  • --hold 2 安装结束后不重启,此时可以 SSH 登录修改系统内容,系统挂载在 /os (此功能不支持 Debian/Kali)

注意事项:

  • 用户名 root 默认密码 123@@@
  • 安装最新版可不输入版本号
  • 最大化利用磁盘空间:不含 boot 分区(Fedora 例外),不含 swap 分区
  • 自动根据机器类型选择不同的优化内核,例如 CloudHWE 内核
  • 安装 Red Hat 时需填写 https://access.redhat.com/downloads/content/rhel 得到的 qcow2 镜像链接,也可以安装其它类 RHEL 系统,例如 Alibaba Cloud Linux 和 TencentOS Server
  • 重装后如需修改 SSH 端口或者改成密钥登录,注意还要修改 /etc/ssh/sshd_config.d/ 里面的文件

最后一步:

重启

reboot

恭喜你,成功重装系统!

感谢该脚本作者作出的贡献

Github项目地址:bin456789/reinstall: 一键DD/重装脚本 (One-click reinstall OS on VPS)

此作者没有提供个人介绍
最后更新于 2025-04-27