在ventoy目录下新建一个ventoy.json的文件,内容如下:
{
"auto_install":[
{
"image": "/CentOS-8.4.2105-x86_64-dvd1.iso",
"template":[
"/ventoy/script/centos_kickstart.cfg"
]
}
],
"conf_replace":[
{
"iso": "/CentOS-8.4.2105-x86_64-dvd1.iso",
"org": "/EFI/BOOT/grub.cfg",
"new": "/ventoy/centos_grub.cfg"
}
]
}
centos_grub.cfg基于原版的grub.cfg修改而成,增加一个选项即可。具体如下:
menuentry 'Install CentOS Linux 8' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS-8-4-2105-x86_64-dvd quiet
initrdefi /images/pxeboot/initrd.img
}
menuentry 'Auto Install CentOS Linux 8' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.ks=/ventoy/script/centos_kickstart.cfg inst.stage2=hd:LABEL=CentOS-8-4-2105-x86_64-dvd quiet
initrdefi /images/pxeboot/initrd.img
}
Kickstart script的通用文件,可以在此基础上自定义:
centos_kickstart.cfg的例子如下:
#version=RHEL8
# Use graphical install
graphical
# Reboot after installation
reboot
# License agreement
eula --agreed
# Keyboard layouts
keyboard --xlayouts='us'
# System language
lang en_US.UTF-8
# Root password
rootpw --iscrypted $6$nmAyTwG6RzmZ2zwd$K7izoYJz7UX7KxCehvj.lF48tLKVSyV//aH3FiD/OwLZhlJCLLWxxzwBw/WXv/DppD.VW2OZuOGUBkjYFkLEt/
user --name=gengzi --password=$6$3SgRrACxWZcxIyXv$Lpyxu9eNTmO7r70oblpUipYJEpTV2dlksysOQZHnwoPGFzl.rkPYPNCEdiudnTjx0HzPEYUdYupFK.zgC3Jup1 --iscrypted --gecos="gengzi"
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --disable
# System timezone
timezone --utc Asia/Shanghai
eula --agreed
firstboot --disable
# Network information
network --bootproto=dhcp --device=enp6s0 --onboot=off --ipv6=auto --no-activate
network --hostname=master
url --url=file:///run/install/repo
%include /tmp/partation.ks
zerombr
#autopart --type=plain
part /boot/efi --fstype="efi" --ondisk=nvme0n1 --size=600 --fsoptions="umask=0077,shortname=winnt"
part /boot --fstype="xfs" --ondisk=nvme0n1 --size=1024
part pv.785 --fstype="lvmpv" --ondisk=nvme0n1 --size=475315
volgroup cl --pesize=4096 pv.785
logvol / --fstype="xfs" --size=307200 --name=root --vgname=cl
logvol swap --fstype="swap" --size=4096 --name=swap --vgname=cl
logvol /home --fstype="xfs" --size=164014 --name=home --vgname=cl
%packages
@^graphical-server-environment
kexec-tools
%end
reboot
%pre
#You can set to sdb/sdc depends on some conditions if you want to install OS to sdb/sdc...
disk_short_name=nvme0n1
echo bootloader --location=mbr --driveorder=$disk_short_name >> /tmp/partation.ks
echo ignoredisk --only-use=$disk_short_name >> /tmp/partation.ks
echo clearpart --all --initlabel --drives=$disk_short_name >> /tmp/partation.ks
%end
参考链接如下:
https://www.ventoy.net/cn/plugin_autoinstall.html
https://www.ventoy.net/cn/plugin_bootconf_replace.html
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。