Linux

Linux下一键网络重装Linux/Windows系统

迷失小白菜 · 3月7日 · 2019年 · 1065次已读

之前主要用的 萌咖Vicer 的网络重装脚本,相当好用。

现在有大佬依Vicer的脚本,重新制作了新的脚本,支持Linux / Windows系统,支持Centos 7 。

安装必须的应用

本重装脚本仅适用于KVM,不适合OpenVZ。

源码安全,并托管在Github
所有系统安装完毕的默认密码是 cxthhhhh.com ,为了防止暴力破解,你必须在安装完毕立刻修改默认密码!
用户名linux是root,windows是administrator

Debian/Ubuntu:

apt-get update
apt-get install -y xz-utils openssl gawk file

RedHat/CentOS:

yum update -y
yum install -y xz openssl gawk file

下载脚本(root用户)

# 原版地址
wget --no-check-certificate -qO ~/Network-Reinstall-System-Modify.sh 'https://www.cxthhhhh.com/tech-tools/Network-Reinstall-System-Modify/Network-Reinstall-System-Modify.sh' && chmod a+x ~/Network-Reinstall-System-Modify.sh
# 备用地址
wget --no-check-certificate -qO ~/Network-Reinstall-System-Modify.sh 'https://blog.wxlost.com/one/tech-tools/Network-Reinstall-System-Modify/Network-Reinstall-System-Modify.sh' && chmod a+x ~/Network-Reinstall-System-Modify.sh

安装Linux系统

①. 一键网络重装纯净CentOS 7(推荐)

bash ~/Network-Reinstall-System-Modify.sh -CentOS_7

②. 一键网络重装纯净CentOS 6

bash ~/Network-Reinstall-System-Modify.sh -CentOS_6

③. 一键网络重装纯净Debian 9(推荐)

bash ~/Network-Reinstall-System-Modify.sh -Debian_9

④. 一键网络重装纯净Debian 8

bash ~/Network-Reinstall-System-Modify.sh -Debian_8

⑤. 一键网络重装纯净Debian 7

bash ~/Network-Reinstall-System-Modify.sh -Debian_7

⑥. 一键网络重装纯净Ubuntu 18.04(推荐)

bash ~/Network-Reinstall-System-Modify.sh -Ubuntu_18.04

⑦. 一键网络重装纯净Ubuntu 16.04

bash ~/Network-Reinstall-System-Modify.sh -Ubuntu_16.04

⑧. 一键网络重装纯净Ubuntu 14.04

bash ~/Network-Reinstall-System-Modify.sh -Ubuntu_14.04

安装Windows系统

①. 一键网络重装纯净Windows Server 2019(推荐)

bash ~/Network-Reinstall-System-Modify.sh -Windows_Server_2019

②. 一键网络重装纯净Windows Server 2016

bash ~/Network-Reinstall-System-Modify.sh -Windows_Server_2016

③. 一键网络重装纯净Windows Server 2012 R2

bash ~/Network-Reinstall-System-Modify.sh -Windows_Server_2012R2

④. 一键网络重装纯净Windows Server 2008 R2

bash ~/Network-Reinstall-System-Modify.sh -Windows_Server_2008R2

⑤. 一键网络重装纯净Windows 7 Vienna

bash ~/Network-Reinstall-System-Modify.sh -Windows_7_Vienna

⑥. 一键网络重装纯净Windows Server 2003

bash ~/Network-Reinstall-System-Modify.sh -Windows_Server_2003

安装裸机系统部署平台

bash ~/Network-Reinstall-System-Modify.sh -CXT_Bare-metal_System_Deployment_Platform

*仅适用于高端用户,手动安装任意系统。可通过网络ISO或iPXE安装任意系统。(使用教程)

DD自己的系统

# %ULR% 替换为您自己的映像地址
bash ~/Network-Reinstall-System-Modify.sh -DD "%URL%"

Linux源 & WIN 激活

KMS 激活方案

2017-1-1 0

其他提示

腾讯云中国版部分机器(腾讯云国际版机器测试没问题)和 DigitalOcean机器请注意,如果安装完无法联网(SSH无法连接)。你应该进入VNC,修改网络配置,设置静态IP。(因为他们的服务商推送了错误的DHCP网关信息,所以自动获取的网络是无效的,无法访问网络。)

vim /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO="static" #dhcp改为static
IPADDR=192.168.1.100 #静态IP
GATEWAY=192.168.1.255 #默认网关
NETMASK=255.255.255.0 #子网掩码
# Centos6的网卡重启方法:
service network restart
# Centos7的网卡重启方法:
systemctl restart network

文章原作者

转自cxthhhhh.com

其他DD教程

  • ORACLE-CENTOS7 ,ORACLE LINUX 重装CENTOS7
重装过的人。 set root='(hd0,gpt3)' 是/boot分区(建议重装时删除/boot分区,留个/boot/efi 分区就行)
# 原文:https://www.hostloc.com/thread-589533-1-1.html
#这句话我没理解意思。。。
# CENTOS7-->CENTOS7

yum -y install wget vim lsof net-tools

cat << EOF >/boot/Reinstall.sh
#!/bin/bash
rm -rf /boot/initrd77.img /boot/vmlinuz77
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/initrd.img -O /boot/initrd77.img
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/vmlinuz -O /boot/vmlinuz77
cat << EOFEOF>/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 \\\$0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry "VNCInstallCentos7" {
    set root='(hd0,gpt3)'
    linuxefi /boot/vmlinuz77 inst.vnc inst.vncpassword=11223355 inst.headless ip=dhcp nameserver=114.114.114.114 inst.repo=http://vault.centos.org/7.2.1511/os/x86_64/ inst.lang=en_US inst.keymap=us
    initrdefi /boot/initrd77.img
}

EOFEOF
#sed -i 's/GRUB_DEFAULT=saved/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
grub2-reboot VNCInstallCentos7
reboot
EOF

bash /boot/Reinstall.sh
# ORACLE  LINUX --> CENTOS7

yum -y install wget vim lsof net-tools

cat << EOF >/boot/Reinstall.sh
#!/bin/bash
rm -rf /boot/initrd77.img /boot/vmlinuz77
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/initrd.img -O /boot/initrd77.img
wget -P /boot/ http://vault.centos.org/7.2.1511/os/x86_64/images/pxeboot/vmlinuz -O /boot/vmlinuz77
cat << EOFEOF>/etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 \\\$0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
menuentry "VNCInstallCentos7" {
    set root='(hd0,gpt3)'
    linuxefi /boot/vmlinuz77 inst.vnc inst.vncpassword=11223355 inst.headless ip=dhcp nameserver=114.114.114.114 inst.repo=http://vault.centos.org/7.2.1511/os/x86_64/ inst.lang=en_US inst.keymap=us
    initrdefi /boot/initrd77.img
}

EOFEOF
#sed -i 's/GRUB_DEFAULT=saved/g' /etc/default/grub
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
grub2-reboot VNCInstallCentos7
reboot
EOF

bash /boot/Reinstall.sh

然后vnc连接机器IP:1 密码为11223355