CentOS

mkdir -p /boot/netinstall && cd /boot/netinstall
wget http://mirrors.aliyun.com/centos/7/os/x86_64/isolinux/vmlinuz -O vmlinuz && chmod 755 vmlinuz
wget http://mirrors.aliyun.com/centos/7/os/x86_64/isolinux/initrd.img -O initrd.img && chmod 600 initrd.img

cat >> /etc/grub.d/40_custom << EOF

menuentry 'CentOS 7 NetInstall' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos1'
    linux16 /boot/netinstall/vmlinuz inst.headless ip=dhcp inst.repo=http://mirrors.aliyun.com/centos/7/os/x86_64 inst.lang=en_US inst.keymap=us
    initrd16 /boot/netinstall/initrd.img
}

EOF

sed -i 's/GRUB_DEFAULT=.*/GRUB_DEFAULT=saved/g' /etc/default/grub
sed -i 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=10/g' /etc/default/grub

grub2-mkconfig -o /boot/grub2/grub.cfg
awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
grub2-reboot "CentOS 7 NetInstall"
reboot
如果觉得我的文章对你有用,请随意赞赏