阿里云腾讯云远程网络重装 CentOS 7

注意:服务器内存至少 2G,否则无法安装

  • 先在控制台把云服务器重装为 CentOS 7
  • 登录服务器,下载启动文件
wget -O /boot/initrd.img https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/initrd.img
wget -O /boot/vmlinuz https://mirrors.aliyun.com/centos/7/os/x86_64/images/pxeboot/vmlinuz

编辑 /etc/grub.d/40_custom 文件

vi /etc/grub.d/40_custom

在后面添加

menuentry "Install CentOS 7" {
    set root='(hd0,msdos1)'
    linux /boot/vmlinuz repo=https://mirrors.aliyun.com/centos/7/os/x86_64/ ip=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx gateway=xxx.xxx.xxx.xxx nameserver=114.114.114.114
    initrd /boot/initrd.img
}

其中'(hd0,msdos1)’表示启动文件所在的分区位置,这里表示第一块硬盘的第一个分区(硬盘从 0 开始计数,分区从 1 开始计数)
ip(IP 地址)、netmask(子网掩码)、gateway(网关)、nameserver(DNS 服务器)按实际情况修改

编辑 /etc/default/grub 文件

vi /etc/default/grub

修改 GRUB_DEFAULT=saved 为

GRUB_DEFAULT="Install CentOS 7"

更新 GRUB2 配置文件

grub2-mkconfig --output=/boot/grub2/grub.cfg

最后重启服务器,使用控制台 VNC 连接服务器即可进入安装界面

Be the first to comment

Leave a Reply

Your email address will not be published.


*