安装mkisofs
yum install -y mkisofs

挂载镜像并确认

并拷贝文件(/mnt 为我们的工作目录)

1.3 准备自动应答文件(保存为 ins.ks)

修改系统引导

实际上就是添加inst.ks 这个引导参数 传递应答文件
传统模式引导

UEFI模式引导

打包镜像

通用选项
-v
:启用详细模式,显示更多输出信息。-cache-inodes
:缓存 inode 表以节省空间。-joliet-long
:允许 Joliet 扩展中的长文件名。-R
:启用 Rock Ridge 扩展,保持 Unix 文件权限等信息。-J
:启用 Joliet 扩展,使得 Windows 系统能够正确读取文件名。-T
:包含 TRANS.TBL 文件,帮助某些旧操作系统识别扩展文件名。-V "CentOS7"
:设置 ISO 卷标为 "CentOS7"。
输出文件
-o /root/CentOS-7-x86_64_autodeploy.iso
:指定输出 ISO 文件的位置和名称。
引导配置(BIOS)
-c isolinux/boot.cat
:指定引导目录文件位置。-b isolinux/isolinux.bin
:指定主引导映像文件路径。-no-emul-boot
:告诉 BIOS 不模拟启动设备。-boot-load-size 4
:设置引导加载大小(通常为 4)。-boot-info-table
:向引导映像添加引导信息表,这对于 Syslinux 是必需的。
引导配置(UEFI)
-eltorito-alt-boot
:指定这是一个替代引导记录(用于多引导)。-b images/efiboot.img
:指定 EFI 引导映像文件路径。-no-emul-boot
:同样地,对于 EFI 引导不模拟启动设备。
源目录
-
.
:当前目录作为源文件夹,即要打包进 ISO 的文件所在的目录。使用 Kickstart 进行自动化安装
https://docs.fedoraproject.org/zh_Hans/fedora/f32/install-guide/advanced/Boot_Options/kickstart
https://pykickstart.readthedocs.io/en/latest/kickstart-docs.html#id20