ks应答文件模板

模板

cat ks.cfg 


#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=static --device=eno5 --gateway=192.168.1.254 --ip=192.168.1.118 --nameserver=114.114.114.114 --netmask=255.255.255.0 --ipv6=auto --activate  ##指定网卡静态IP信息
network  --bootproto=dhcp --device=eno6 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=eno7 --onboot=off --ipv6=auto
network  --bootproto=dhcp --device=eno8 --onboot=off --ipv6=auto
network  --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$JEae7CpqKVn5//ec$qdY1Js76iK/VQMAXjJUkrBlzeBNnMr5sCphC3miskYW3pw2nokXhSaoIRggiS3eI2TRKGXM2EmKsiuyjRp4Do1    # 设置用户名和密码
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp  # 设置时区
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda   # 选择磁盘分区
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part swap --fstype="swap" --ondisk=sda --size=65536
part /boot --fstype="xfs" --ondisk=sda --size=500
part /tmp --fstype="xfs" --ondisk=sda --size=102400
part /opt --fstype="xfs" --ondisk=sda --size=1024
part /boot/efi --fstype="efi" --ondisk=sda --size=500 --fsoptions="umask=0077,shortname=winnt"
part /usr/local --fstype="xfs" --ondisk=sda --size=102400
part / --fstype="xfs" --ondisk=sda --size=102400
part /home --fstype="xfs" --ondisk=sda --size=51200
part /usr --fstype="xfs" --ondisk=sda --size=10240
part /var --fstype="xfs" --ondisk=sda --size=1 --grow   # 剩余全部给 /var下


%packages     # 安装软件应用
@^minimal    
@compat-libraries   
@core
@debugging
@development
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
reboot

拓展

  1. 更改三个文件,指定镜像标签和KS文件,都是在镜像挂载目录
vim EFI/BOOT/grub.cfg

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Install CentOS 7' --class fedora --class gnu-linux --class gnu --class os {
  linuxefi /images/pxeboot/vmlinuz inst.ks=hd:LABEL=CentOS7:/ks.cfg  inst.stage2=hd:LABEL=CentOS7  quiet
  initrdefi /images/pxeboot/initrd.img
}




vim isolinux/isolinux.cfg

label linux
  menu label ^Install CentOS 7
  kernel vmlinuz
  menu default
  append initrd=initrd.img  inst.ks=hd:LABEL=CentOS7:/ks.cfg  inst.stage2=hd:LABEL=CentOS7  quiet

label check
  menu label Test this ^media & install CentOS 7
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet




vim isolinux/grub.conf

title Install CentOS 7
  findiso
  kernel @KERNELPATH@ @ROOT@ quiet inst.ks=cdrom:/ks.cfg
  initrd @INITRDPATH@

在这里插入图片描述

  1. 制作命令
genisoimage -joliet-long -V CentOS7 -o CentOS7.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -cache-inodes -T -eltorito-alt-boot -e images/efiboot.img -no-emul-boot /root/centos_install
# -o 指定镜像标签,和上面的配置文件里的一样,
# 打包的镜像也是这个名字,如***.iso  另外也可以加路径,指定生成到哪里

genisoimage -joliet-long -V CentOS7 -o CentOS7.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -cache-inodes -T -eltorito-alt-boot -e images/efiboot.img -no-emul-boot /root/centos_install

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

king config

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值