PXE Boot : Configure PXE Server
[1] Install and Start TFTP.
dnf -y install tftp-server
systemctl enable --now tftp.socket
[2] Configure DHCP Server.
dnf -y install dhcp-server
vi /etc/dhcp/dhcpd.conf
option domain-name "srv.world";
option domain-name-servers dlp.srv.world;
default-lease-time 600;
max-lease-time 7200;
authoritative;
# add follows
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;
subnet 10.0.0.0 netmask 255.255.255.0 {
range dynamic-bootp 10.0.0.200 10.0.0.254;
option broadcast-address 10.0.0.255;
option routers 10.0.0.1;
# add follows
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient
";
# PXE servers hostname or IP address
next-server 10.0.0.30;
if option architecture-type = 00:07 {
filename "BOOTX64.EFI";
}
else {
filename "pxelinux.0";
}
}
}
systemctl restart dhcpd
mkdir rpm
dnf -y install --downloadonly --downloaddir=/root/rpm shim grub2-efi-x64
cd rpm
rpm2cpio shim-x64-*.rpm | cpio -dimv
rpm2cpio grub2-efi-x64-*.rpm | cpio -dimv
cp ./boot/efi/EFI/BOOT/BOOTX64.EFI /var/lib/tftpboot/
cp ./boot/efi/EFI/centos/grubx64.efi /var/lib/tftpboot/
chmod 644 /var/lib/tftpboot/{BOOTX64.EFI,grubx64.efi}
cd
mkdir -p /var/pxe/centos-st9
mkdir /var/lib/tftpboot/centos-st9
mount -t iso9660 -o loop,ro /home/CentOS-Stream-9-latest-x86_64-dvd1.iso
/var/pxe/centos-st9
cp /var/pxe/centos-st9/images/pxeboot/{vmlinuz,initrd.img}
/var/lib/tftpboot/centos-st9/
vi /var/lib/tftpboot/grub.cfg
# create new
# replace PXE servers hostname or IP address to your own one
set timeout=10
menuentry 'Install CentOS Stream 9' {
linuxefi centos-st9/vmlinuz ip=dhcp inst.repo=http://10.0.0.30/centos-st9
initrdefi centos-st9/initrd.img
}
[1] Install httpd
dnf -y install httpd
vi /etc/httpd/conf.d/pxeboot.conf
# create new
Alias /centos-st9 /var/pxe/centos-st9
<Directory /var/pxe/centos-st9>
Options Indexes FollowSymLinks
# access permission
Require ip 127.0.0.1 10.0.0.0/24
</Directory>
systemctl restart httpd
Automate Network Installation by Kick Star t
[2] Configure Kick Start settings.