Introduction
A network boot installation allows you to install CentOS to a system with access to an installation server. At a minimum, two approaches are required for a network installation:
PXE Server: A system running a DHCP server, a TFTP server, and an HTTP, HTTPS, FTP, or NFS server. While each server can run on a different physical system, the procedures in this section assume a single system is running all servers.
Client: The system to which you are installing CentOS. Once installation starts, the client queries the DHCP server, receives the boot files from the TFTP server, and downloads the installation image from the HTTP, HTTPS, FTP, or NFS server. Unlike other installation methods, the client does not require any physical boot media for the installation to start.
To boot a client from the network, configure it in BIOS/UEFI or a quick boot menu. On some hardware, the option to boot from a network might be disabled, or not available.
Items that are required.
- Export the installation ISO image (or the installation tree) to an NFS, HTTPS, HTTP, or FTP server.
- Configure the TFTP server and DHCP server, and start the TFTP service on the PXE server.
- Boot the client, and start the installation.
TFTP server for BIOS-based clients network boot
This procedure describes how to configure a TFTP server and DHCP server and start the TFTP service on the PXE server for BIOS-based AMD and Intel 64-bit systems.
As root, install the tftp-server
package
# yum install tftp-server httpd
or
# dnf install tftp-server httpd
Configure your DHCP server to use the boot images packaged with SYSLINUX. A sample configuration in the /etc/dhcp/dhcpd.conf file might look like:
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 {
option routers 192.168.0.254;
range 192.168.0.2 10.0.0.253;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.0.1;
if option architecture-type = 00:07 {
filename "uefi/shim.efi";
} else {
filename "pxelinux/pxelinux.0";
}
}
}
Start and enable the dhcpd
service:
# systemctl start dhcpd
# systemctl enable dhcpd
Configure tftp server for network boot
# vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
Start and enable the xinetd
service that manages the tftp
service:
# systemctl start xinetd
# systemctl enable xinetd
Setup TFTP Server network boot files
# mkdir -p /var/pxe/centos8
# mkdir /var/lib/tftpboot/centos8
# wget http://mirror.hostlink.com.hk/centos/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-dvd1.iso
# mount CentOS-Stream-8-x86_64-latest-dvd1.iso /var/pxe/centos8
# cp /var/pxe/centos8/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/centos8/
# cp /usr/share/syslinux/{menu.c32,vesamenu.c32,ldlinux.c32,libcom32.c32,libutil.c32} /var/lib/tftpboot/
# mkdir /var/lib/tftpboot/pxelinux.cfg
# vi /var/lib/tftpboot/pxelinux.cfg/default
# create new
# replace PXE servers hostname or IP address to your own one
default vesamenu.c32
prompt 1
timeout 60
display boot.msg
label linux
menu label ^Install CentOS 8
menu default
kernel centos8/vmlinuz
append initrd=centos8/initrd.img ip=dhcp inst.repo=http://192.168.0.30/centos8
label vesa
menu label Install CentOS 8 with ^basic video driver
kernel centos8/vmlinuz
append initrd=centos8/initrd.img ip=dhcp inst.xdriver=vesa nomodeset inst.repo=http://192.168.0.30/centos8
label rescue
menu label ^Rescue installed system
kernel centos8/vmlinuz
append initrd=centos8/initrd.img rescue
label local
menu label Boot from ^local drive
localboot 0xffff
Configure PXE configuration network boot
Dracut as the kernel command line option provider. It supports PXE booting over HTTP. Going to use the Apache 2 webserver to serve files over the network
# vi /etc/httpd/conf.d/pxeboot.conf
# create new
Alias /centos8 /var/pxe/centos8
<Directory /var/pxe/centos8>
Options Indexes FollowSymLinks
# access permission
Require ip 127.0.0.1 192.168.0.0/24
</Directory>
# systemctl restart httpd