How to Build a PXE‑Kickstart Unattended Installation Server on CentOS 7
This step‑by‑step guide explains how to set up a PXE, Kickstart, TFTP, DHCP, and FTP environment on a single CentOS 7 server to perform fully automated, network‑based OS installations for multiple client machines.
1. Required Services Overview
PXE : Remote boot technology that allows a computer to start via network.
Kickstart : Unattended OS deployment using an answer file.
TFTP : Simple file transfer protocol (port 69) used to share PXE boot files.
DHCP : Assigns IP addresses to client machines.
FTP : Shares ISO images and the Kickstart answer file.
2. Experiment Setup
All services (FTP, DHCP, TFTP) are deployed on a single server (qll251, CentOS 7 with dual NICs 192.168.1.251 and 192.168.2.251). The client machine (qll252) uses the LAN1 network.
Requirements:
Disable firewall and SELinux.
Ensure yum can install packages (local or remote repository).
3. Deploy Services
3.1 Install and start FTP
[root@qll251 ~]# yum -y install vsftpd</code><code>[root@qll251 ~]# systemctl start vsftpd</code><code>[root@qll251 ~]# systemctl enable vsftpdShared path:
/var/ftp3.2 Install and configure DHCP
[root@qll251 ~]# yum -y install dhcp</code><code>[root@qll251 ~]# vim /etc/dhcp/dhcpd.conf</code><code>[root@qll251 ~]# systemctl start dhcpd</code><code>[root@qll251 ~]# systemctl enable dhcpdTypical configuration assigns IPs to PXE clients.
3.3 Install and configure TFTP
[root@qll251 ~]# yum -y install tftp-server</code><code>[root@qll251 ~]# yum -y install xinetd</code><code>[root@qll251 ~]# systemctl start tftp && systemctl enable tftp</code><code>[root@qll251 ~]# systemctl start xinetd && systemctl enable xinetdShared directory:
/var/lib/tftpboot3.4 Prepare PXE boot files
[root@qll251 ~]# yum -y install syslinux</code><code>[root@qll251 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/</code><code>[root@qll251 ~]# cp /media/images/pxeboot/initrd.img /var/lib/tftpboot/</code><code>[root@qll251 ~]# cp /media/images/pxeboot/vmlinuz /var/lib/tftpboot/</code><code>[root@qll251 ~]# mkdir /var/lib/tftpboot/pxelinux.cfg</code><code>[root@qll251 ~]# cp /media/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default</code><code>[root@qll251 ~]# chmod 644 /var/lib/tftpboot/pxelinux.cfg/defaultEdit /var/lib/tftpboot/pxelinux.cfg/default to include:
default linux</code><code>label linux</code><code> menu label ^Install CentOS 7</code><code> kernel vmlinuz</code><code> append initrd=initrd.img inst.repo=ftp://192.168.2.251/pub inst.ks=ftp://192.168.2.251/ks.cfg3.5 Create Kickstart answer file
[root@qll251 ~]# yum -y install system-config-kickstart</code><code># Run the graphical tool</code><code>system-config-kickstartSave the generated ks.cfg to /var/ftp/ks.cfg. Ensure the ISO files are copied to /var/ftp/pub:
# cp -r /media/* /var/ftp/pub4. Prepare PXE Boot Files
Mount the installation ISO: [root@qll251 ~]# mount /dev/sr0 /media Share the following via FTP:
/var/ftp/ks.cfg
All files from the mounted ISO (copied to /var/ftp/pub)
Share the following via TFTP:
pxelinux.0
initrd.img
vmlinuz
pxelinux.cfg/default (modified as above)
5. Execute Batch Installation
Set client BIOS to boot from network (or press F12 at startup).
The client will download the PXE configuration, retrieve the kernel and initrd via TFTP, then fetch the installation source and Kickstart file via FTP, performing a fully automated installation without manual intervention.
After installation, log in with the predefined root password; the test script “hello world” runs, and the client receives IP 192.168.2.3.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
