label autoinstall
menu label ^Auto install Red Hat Enterprise Linux 7.6
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 ks=cdrom:/ks.cfg
label linux
menu label ^Install Red Hat Enterprise Linux 7.6
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 quiet
label check
menu label Test this ^media & install Red Hat Enterprise Linux 7.6
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 rd.live.check quiet
我从 check 标签中移除了 menu default,并将其添加到了 autoinstall 标签中,以使 autoinstall 标签成为默认的引导选项。
menuentry 'Auto install Red Hat Enterprise Linux 7.6' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 ks=cdrom:/ks.cfg
initrdefi /images/pxeboot/initrd.img
}
menuentry 'Install Red Hat Enterprise Linux 7.6' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 quiet
initrdefi /images/pxeboot/initrd.img
}
menuentry 'Test this media & install Red Hat Enterprise Linux 7.6' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 rd.live.check quiet
initrdefi /images/pxeboot/initrd.img
}
---
tags:
- Linux
---
# Kickstart Installation for RHEL and CentOS
!!! warning "文档时效性说明"
本文为早期笔记,可能存在版本过时、命令失效、链接失效、最佳实践变化等问题。请以官方最新文档为准。
## Mount and copy contents
```bash
cd /tmp/
mkdir isomake
sudo mount /var/lib/libvirt/images/iso/rhel-server-7.6-x86_64-dvd.iso /mnt/
rsync -aAHXv --info=progress2 --no-i-r /mnt/ /tmp/isomake/
cd isomake/
Put a kickstart file under root directory of cdrom¶
Copy "/root/anaconda-ks.cfg" from an installed system to the root of cdrom directory, and name it "ks.cfg":
label autoinstall
menu label ^Auto install Red Hat Enterprise Linux 7.6
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 ks=cdrom:/ks.cfg
label Linux
menu label ^Install Red Hat Enterprise Linux 7.6
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 quiet
label check
menu label Test this ^media & install Red Hat Enterprise Linux 7.6
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 rd.live.check quiet
I removed "menu default" from the check label and added in the autoinstall label to make autoinstall label the default boot option.
menuentry 'Auto install Red Hat Enterprise Linux 7.6' --class Fedora --class gnu-Linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 ks=cdrom:/ks.cfg
initrdefi /images/pxeboot/initrd.img
}
menuentry 'Install Red Hat Enterprise Linux 7.6' --class Fedora --class gnu-Linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 quiet
initrdefi /images/pxeboot/initrd.img
}
menuentry 'Test this media & install Red Hat Enterprise Linux 7.6' --class Fedora --class gnu-Linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-7.6\x20Server.x86_64 rd.live.check quiet
initrdefi /images/pxeboot/initrd.img
}
I auto modified set default="0" to set the default boot option to the first entry.
Note: "RHEL-7.6 Server.x86_64" is the label of the ISO image. Please change it to the label after "inst.stage2=hd:LABEL=" in "isolinux/isolinux.cfg".
```