创建一个 Kickstart 文件:

Kickstart 文件是一个文本文件,可以使用任何可用的文本编辑器创建。
此外,我们在 Linux 中还有一个非常方便的 GUI 工具,称为 Kickstart Configurator。
使用 Kickstart Configurator,我们只需选择选项,软件就会自动生成 Kickstart 文件。

Kickstart 配置器在 system-config-kickstart.noarch 包中提供。
并且可以使用命令 system-config-kickstart 运行(你需要一个 X-Server 来显示软件界面)。
Kickstart Configurator 的部分截图如下:

Kickstart Configurator 是一款安静方便的工具,任何人只需点击几下即可创建复杂的 Kickstart 文件。

或者,我们可以使用系统生成的 Kickstart 模板,该模板由 Anaconda 安装程序在操作系统安装过程中在 root 用户的主目录(即 /root/anaconda-ks.cfg )中创建。
该文件包含在该机器上安装操作系统期间所做的实际用户输入/选择。
因此,我们可以根据我们的要求调整内容后使用此 Kickstart 模板。

将 anaconda-ks.cfg 复制到我们的 FTP 公共目录。

[root@pxe-server ~]# cp anaconda-ks.cfg /var/ftp/pub/rhel7/rhel7.cfg
[root@pxe-server ~]# chmod +r /var/ftp/pub/rhel7/rhel7.cfg

现在编辑rhel7.cfg 文件。

[root@pxe-server ~]# vi /var/ftp/pub/rhel7/rhel7.cfg

rhel7.cfg 文件参考:

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $vyNMLtgd$VmtByshddZSBK..uuFhoH0
# Use network installation
url --url="ftp://192.168.1.41/pub/rhel7"
# System language
lang en_US
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# SELinux configuration
selinux --enforcing
# Firewall configuration
firewall --enabled --ssh
# Network information
network  --bootproto=dhcp --device=eth0
# Reboot after installation
reboot
# System timezone
timezone Asia/Karachi
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
# Packages to be installed
%packages
@core
%end

我们已经成功地为自动安装创建了一个 Kickstart 文件。
为了让我们的 PXE 引导服务器可以使用它,我们必须将它包含在 tftp 的菜单命令中。

Kickstart:自动化 PXE 客户端安装

Kickstart 是一种安装方法,Red Hat 使用它来自动执行无人值守的操作系统安装和配置。
使用 Kickstart,系统管理员可以创建一个文件,其中包含典型安装过程中通常会问到的所有问题的答案。

在我们之前的文章“在 RHEL/CentOS 7 中搭建 PXE 引导服务器
”中,我们为新系统的网络安装配置了一个 PXE 引导服务器。

但是,安装方法是手动的。
现在,在本文中,我们将 Kickstart 与 PXE 引导服务器相结合,为我们的 PXE 客户端设置全自动、无人值守和一致的安装。

on  it road.com

配置 PXE 引导服务器以使用 Kickstart 文件

编辑基于 BIOS 的客户端的 PXE 启动菜单。

[root@pxe-server ~]# vi /var/lib/tftpboot/pxelinux.cfg/default

并其中添加 kickstart 指令。
编辑后该文件的内容为:

default menu.c32
prompt 0
timeout 30
menu title JackLi's PXE Menu
label Install RHEL 7.5
kernel /networkboot/rhel7/vmlinuz
append initrd=/networkboot/rhel7/initrd.img inst.repo=ftp://192.168.1.41/pub/rhel7 ks=ftp://192.168.1.41/pub/rhel7/rhel7.cfg

同样,编辑基于 UEFI 的客户端的 PXE 启动菜单。

[root@pxe-server ~]# vi /var/lib/tftpboot/grub.cfg

并其中添加 kickstart 指令。
编辑后该文件的内容为:

set timeout=60
menuentry 'Install RHEL 7.5' {
        linuxefi /networkboot/rhel7/vmlinuz inst.repo=ftp://192.168.1.41/pub/rhel7/ inst.ks=ftp://192.168.1.41/pub/rhel7/rhel7.cfg
        initrdefi /networkboot/rhel7/initrd.img
}

使用基于 BIOS 和 UEFI 的机器测试配置。
现在,整个安装是自动化的,操作系统将按照我们的 Kickstart 文件进行安装和配置。

日期:2020-09-17 00:11:53 来源:oir作者:oir