hello world

通过 ssh 重新安装linux 系统 (centos 7/8)

centos7/8 的启动是基于 grub2的。

直接上步骤吧:
前期准备:
SSH登陆系统
拿到系统的网络信息。网卡设备号、IP、掩码、网关、dns
本地的:
ens32、192.168.60.131、24、192.168.60.2、114.114.114.114

开始
1、将光盘或网络上的 initrd.img 、vmlinuz下载到本地/boot目录下(我选的是阿里的)

wget http://mirrors.aliyun.com/centos/7.8.2003/os/x86_64/isolinux/initrd.img

wget http://mirrors.aliyun.com/centos/7.8.2003/os/x86_64/isolinux/vmlinuz

注:阿里云的8.2的地址:http://mirrors.aliyun.com/centos/8.2.2004/BaseOS/x86_64/os/

2、在/etc/grub.d/40_custom 中末尾添加信息并保存

vi /etc/grub.d/40_custom

menuentry 'netinstall' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  76baf7f4-87f8-4606-8ac9-2ba1bc685c67
        else
          search --no-floppy --fs-uuid --set=root 76baf7f4-87f8-4606-8ac9-2ba1bc685c67
        fi
    linux16 /vmlinuz inst.vnc inst.vncpassword=12345678 inst.headless ip=192.168.60.131::192.168.60.2:255.255.255.0::ens32:none nameserver=114.114.114.114 inst.repo=http://mirrors.aliyun.com/centos/7.8.2003/os/x86_64/ inst.lang=en_US inst.keymap=us inst.sshd
    initrd16 /initrd.img
}

注:重点 以上内容复制于 /boot/grub2/grub.cfg中的相对应的字段,一定要复制你本机的,一定要复制你本机的。

3、

让系统自动生成配置启动文件

grub2-mkconfig -o /boot/grub2/grub.cfg

默认启动词条

grub2-reboot netinstall

重启系统

reboot

参考:https://www.cnblogs.com/gleaners/p/5736521.html?utm_source=itdadao&utm_medium=referral
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options
https://www.danpros.com/2016/02/how-to-install-centos-7-remotely-using-vnc
https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options#sect-boot-options-installer

posted @ 2020-08-07 09:41  这一天  阅读(1631)  评论(0)    收藏  举报