Linux系统DD一键脚本

发布时间 2023-08-15 20:42:20作者: 冰桃美酒

使用脚本存在一定的风险,谨慎使用。
重统重装之后,请重新设置密码。

脚本介绍

GitHub 地址:GitHub - leitbogioro/Tools

  • 全自动无人值守安装;
  • 支持各主流 VPS 商家;
  • 系统支持情况:Debian 12、Kali Rolling、Alpine Linux Edge、CentOS 9 stream、AlmaLinux 9、RockyLinux 9、Fedora 38、Ubuntu 22.04、Windows Server 2022

脚本使用

安装wget

  • Debian 系(Debian / Ubuntu / Kali):
apt update -y
apt install wget -y
  • RedHat 系, only based on RedHat 7+, grub2(CentOS / AlmaLinux / RockyLinux / OracleLinux / Fedora / VzLinux / ScientificOS / RedHat Enterprise Linux / Tencent OpenCloudOS / AWS AmazonLinux / AlibabaCloudLinux or AliyunLinux / OpenAnolis):
yum install wget -y
  • 对于Alpine Linux:
apk update
apk add bash wget
sed -i 's/root:\/bin\/ash/root:\/bin\/bash/g' /etc/passwd

安装脚本

  • 国外:
wget --no-check-certificate -qO InstallNET.sh 'https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh
  • 国内:
wget --no-check-certificate -qO InstallNET.sh 'https://gitee.com/mb9e8j2/Tools/raw/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh

开始DD

本文以Debian举例

## 默认安装最新的系统
bash InstallNET.sh -debian

也可以通过-pwd 密码指定系统DD过之后的SSH密码,通过-port指定系统DD过之后的SSH端口。
所有命令的例子:

bash InstallNET.sh -debian/kali/ubuntu/centos/almalinux/rockylinux/fedora(os type) 11(os version) -version 64(os bit, not necessary) -port "your server port" -pwd "your server password" -mirror "a valid url for linux image source" -dd/--image "dd image url" -filetype "gz or xz" -timezone "like Asia/Tokyo etc" --dhcp-static/--ip-addr 'x.x.x.x'(ip address) --ip-mask 'x.x.x.x'(subnet mask) --ip-gate 'x.x.x.x'(gateway) -firmware(Debian with hardware drivers)

其余命令参数可以前往Github地址查看。

最后

何逊扬州旧事,五更梦半醒,胡调吹彻