CentOS8手动编辑定制生成应答文件anaconda-ks.cfg

2024-04-10 01:32

本文主要是介绍CentOS8手动编辑定制生成应答文件anaconda-ks.cfg,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

CentOS8应答文件

记录了安装系统时的操作
可以用此为基础创建自定义应答文件

kickstart文件主要包括三个部分:

命令段,程序包段,脚本段

手动编辑定制生成应答文件

  • CentOS6和7中的图形化工具在CentOS8中没有了
  • 只能通过手动编辑并定制生成应答文件

拷贝系统中原生anaconda-ks.cfg

cp anaconda-ks.cfg ks8.cfg

编辑ks8.cfg应答文件

#version=RHEL8
ignoredisk --only-use=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
# Use CDROM installation media
cdrom
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8# Network information
network  --bootproto=dhcp --device=ens33 --ipv6=auto --activate
network  --hostname=localhost.localdomain
repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Root password
rootpw --iscrypted $6$0oNcn58oJTkyswqj$ZSA1obbRFFvijoTaiY.GJsBz1CBhIOWt7eEIC7jdZTUZbifpJnR1f8ekUJwc4RTVi/XY5xX/YmkcfFEllTWCZ.
# Run the Setup Agent on first boot
firstboot --enable
# Do not configure the X Window System
skipx
# System services
services --enabled="chronyd"
# System timezone
timezone America/New_York --isUtc%packages
@^server-product-environment
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
修改需要的项
#version=RHEL8
#ignoredisk --only-use=sda ## 分区信息改喽
ignoredisk --only-use=sda
zerombr
#autopart --type=lvm 
#autopart --type=lvm
#part / --fstype xfs --size 1 --grow --ondisk sda 可以实现根自动使用所有剩余空间
part / --fstype="xfs" --ondisk=sda --size=102400
part /data --fstype="xfs" --ondisk=sda --size=51200
part swap --fstype="swap" --ondisk=sda --size=2048
part /boot --fstype="ext4" --ondisk=sda --size=1024
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
## graphical ## 图形化安装改喽
# Use text mode install
text
# Setup Firewall
selinux --disabled
firewall --disabled# Use CDROM installation media ## 安装介质改喽
## cdrom
# Use network installation
url --url="http://10.0.0.88/centos/8/os/x86_64/"
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8# Network information ## 网卡名改喽
network  --bootproto=dhcp --device=eth0 --ipv6=auto --activate
network  --hostname=localhost.localdomain
## repo位置改喽
# repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
repo --name="AppStream" --baseurl=http://10.0.0.88/centos/8/os/x86_64/AppStream/
# Root password ## 密码改喽
## rootpw --iscrypted ## $6$0oNcn58oJTkyswqj$ZSA1obbRFFvijoTaiY.GJsBz1CBhIOWt7eEIC7jdZTUZbifpJnR1f8ekUJwc4RTVi/XY5xX/YmkcfFEllTWCZ.
rootpw --iscrypted $1$Zmb3GPCH$gNU/fyVaRKbqZeFATib3k/
# Run the Setup Agent on first boot
firstboot --enable
# Setup Booterloader
bootloader --append="net.ifnames=0" --location=mbr --boot-drive=sda
# Do not configure the X Window System
skipx
# System services ## 系统服务改喽
## services --enabled="chronyd"
services --disabled="chronyd"
# System timezone
timezone America/New_York --isUtc%packages
## @^server-product-environment ## 安装包先择,改喽
## kexec-tools
@^minimal-environment
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
yum -y install curl
curl 10.0.0.88/shell/newSet.sh | bash
curl 10.0.0.88/shell/sshpass.sh | bash
%end

汇总归一

ignoredisk --only-use=sda
zerombr
text
reboot
clearpart --all --initlabel
selinux --disabled
firewall --disabled
url --url=http://10.0.0.88/centos/8/os/x86_64/
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
network --bootproto=dhcp --device=eth0 --ipv6=auto --activate
network --hostname=server8.timonium.co
bootloader --append="net.ifnames=0" --location=mbr --boot-drive=sdarootpw --iscrypted $1$Zmb3GPCH$gNU/fyVaRKbqZeFATib3k/
firstboot --enable
skipx
services --disabled="chronyd"
timezone Asia/Shanghai --isUtc --nontp
#autopart --type=lvm
#part / --fstype xfs --size 1 --grow --ondisk sda 可以实现根自动使用所有剩余空间
part / --fstype="xfs" --ondisk=sda --size=102400
part /data --fstype="xfs" --ondisk=sda --size=51200
part swap --fstype="swap" --ondisk=sda --size=2048
part /boot --fstype="ext4" --ondisk=sda --size=1024
%packages
@^minimal-environment
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
%post
yum -y install curl
curl 10.0.0.88/shell/newSet.sh | bash
curl 10.0.0.88/shell/sshpass.sh | bash
%end

创建ks8.cfg在HTTP服务器目录下

cat > /var/www/html/ks/ks8.cfg <<EOF
> ignoredisk --only-use=sda
> zerombr
> text
> reboot
> clearpart --all --initlabel
> selinux --disabled
> firewall --disabled
> url --url=http://10.0.0.88/centos/8/os/x86_64/
> keyboard --vckeymap=us --xlayouts='us'
> lang en_US.UTF-8
> network --bootproto=dhcp --device=eth0 --ipv6=auto --activate
> network --hostname=server8.timonium.co
> bootloader --append="net.ifnames=0" --location=mbr --boot-drive=sda
> 
> rootpw --iscrypted $1$Zmb3GPCH$gNU/fyVaRKbqZeFATib3k/
> firstboot --enable
> skipx
> services --disabled="chronyd"
> timezone Asia/Shanghai --isUtc --nontp
> #autopart --type=lvm
> #part / --fstype xfs --size 1 --grow --ondisk sda 可以实现根自动使用所有剩余空间
> part / --fstype="xfs" --ondisk=sda --size=102400
> part /data --fstype="xfs" --ondisk=sda --size=51200
> part swap --fstype="swap" --ondisk=sda --size=2048
> part /boot --fstype="ext4" --ondisk=sda --size=1024
> %packages
> @^minimal-environment
> 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
> %post --nochroot
yum -y install curl
curl 10.0.0.88/shell/newSet.sh | bash
curl 10.0.0.88/shell/sshpass.sh | bash
%end
> EOF

这篇关于CentOS8手动编辑定制生成应答文件anaconda-ks.cfg的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/889741

相关文章

Java使用Spire.Barcode for Java实现条形码生成与识别

《Java使用Spire.BarcodeforJava实现条形码生成与识别》在现代商业和技术领域,条形码无处不在,本教程将引导您深入了解如何在您的Java项目中利用Spire.Barcodefor... 目录1. Spire.Barcode for Java 简介与环境配置2. 使用 Spire.Barco

SpringBoot集成iText快速生成PDF教程

《SpringBoot集成iText快速生成PDF教程》本文介绍了如何在SpringBoot项目中集成iText9.4.0生成PDF文档,包括新特性的介绍、环境准备、Service层实现、Contro... 目录SpringBoot集成iText 9.4.0生成PDF一、iText 9新特性与架构变革二、环

idea-java序列化serialversionUID自动生成方式

《idea-java序列化serialversionUID自动生成方式》Java的Serializable接口用于实现对象的序列化和反序列化,通过将对象转换为字节流来存储或传输,实现Serializa... 目录简介实现序列化serialVersionUID配置使用总结简介Java.io.Seripyth

Java中的随机数生成案例从范围字符串到动态区间应用

《Java中的随机数生成案例从范围字符串到动态区间应用》本文介绍了在Java中生成随机数的多种方法,并通过两个案例解析如何根据业务需求生成特定范围的随机数,本文通过两个实际案例详细介绍如何在java中... 目录Java中的随机数生成:从范围字符串到动态区间应用引言目录1. Java中的随机数生成基础基本随

C#自动化生成PowerPoint(PPT)演示文稿

《C#自动化生成PowerPoint(PPT)演示文稿》在当今快节奏的商业环境中,演示文稿是信息传递和沟通的关键工具,下面我们就深入探讨如何利用C#和Spire.Presentationfor.NET... 目录环境准备与Spire.Presentation安装核心操作:添加与编辑幻灯片元素添加幻灯片文本操

Python实现Word文档自动化的操作大全(批量生成、模板填充与内容修改)

《Python实现Word文档自动化的操作大全(批量生成、模板填充与内容修改)》在职场中,Word文档是公认的好伙伴,但你有没有被它折磨过?批量生成合同、制作报告以及发放证书/通知等等,这些重复、低效... 目录重复性文档制作,手动填充模板,效率低下还易错1.python-docx入门:Word文档的“瑞士

使用python生成固定格式序号的方法详解

《使用python生成固定格式序号的方法详解》这篇文章主要为大家详细介绍了如何使用python生成固定格式序号,文中的示例代码讲解详细,具有一定的借鉴价值,有需要的小伙伴可以参考一下... 目录生成结果验证完整生成代码扩展说明1. 保存到文本文件2. 转换为jsON格式3. 处理特殊序号格式(如带圈数字)4

Java使用Swing生成一个最大公约数计算器

《Java使用Swing生成一个最大公约数计算器》这篇文章主要为大家详细介绍了Java使用Swing生成一个最大公约数计算器的相关知识,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一下... 目录第一步:利用欧几里得算法计算最大公约数欧几里得算法的证明情形 1:b=0情形 2:b>0完成相关代码第二步:加

Linux云服务器手动配置DNS的方法步骤

《Linux云服务器手动配置DNS的方法步骤》在Linux云服务器上手动配置DNS(域名系统)是确保服务器能够正常解析域名的重要步骤,以下是详细的配置方法,包括系统文件的修改和常见问题的解决方案,需要... 目录1. 为什么需要手动配置 DNS?2. 手动配置 DNS 的方法方法 1:修改 /etc/res

k8s admin用户生成token方式

《k8sadmin用户生成token方式》用户使用Kubernetes1.28创建admin命名空间并部署,通过ClusterRoleBinding为jenkins用户授权集群级权限,生成并获取其t... 目录k8s admin用户生成token创建一个admin的命名空间查看k8s namespace 的