Operations 8 min read

Automate Linux Deployments with PXE: A Complete Step‑by‑Step Guide

This tutorial walks you through setting up a PXE‑based automated Linux installation environment, covering DHCP, TFTP, HTTP services, kickstart configuration, necessary boot files, and the final deployment of CentOS 6.5 on virtual machines.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Automate Linux Deployments with PXE: A Complete Step‑by‑Step Guide

Introduction

Deploying Linux on dozens or hundreds of servers manually is inefficient; using PXE (Preboot Execution Environment) enables batch installation over the network.

Principle

PXE uses a network card’s built‑in PXE boot ROM to obtain a boot program via TFTP and DHCP, replacing traditional media‑based boot loaders.

Experiment Environment

VMware Workstation 10 with a CentOS 6.5 x86_64 guest.

1. Configure DHCP Service

1. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 to enable the NIC at boot and set a static IP.

2. Disable the firewall to avoid TFTP interference.

3. Permanently disable SELinux by editing /etc/sysconfig/selinux.

4. Install the DHCP package: yum -y install dhcp 5. Copy the sample configuration file and modify it:

cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

6. Start and enable the DHCP daemon (see screenshots).

7. Verify the DHCP server by connecting a Windows 7 client on the same virtual network and confirming it receives an IP address.

2. Configure TFTP Service

Install TFTP and its super‑server: yum -y install tftp tftp-server The TFTP server runs under xinetd, which must be enabled at boot ( chkconfig tftp on).

Test the TFTP server by placing a file in /var/lib/tftpboot/ and retrieving it from the local host and a second Linux client.

3. Configure HTTP Service

Install Apache: yum -y install httpd Enable and start the service, then create /media/cdrom to mount the installation ISO and expose it via /var/www/html/centos/6/x86_64 for PXE clients.

4. Create kickstart.cfg

Install the kickstart GUI tool: yum -y install system-config-kickstart Open the generated anaconda-ks.cfg, adjust basic configuration, installation method, boot loader options, partitioning, network (set eth0 to DHCP), disable firewall and SELinux, and save as centos-6.5-ks.cfg in the HTTP directory.

5. Provide PXE Boot Files

1. Install syslinux to obtain pxelinux.0 and copy it to /var/lib/tftpboot/.

2. Copy the kernel ( vmlinuz) and initrd ( initrd.img) from the installation media to the TFTP directory.

3. Copy additional files ( boot.msg, splash.jpg, vesamenu.c32) from the ISO’s isolinux/ directory.

4. Copy isolinux.cfg to /var/lib/tftpboot/pxelinux.cfg/default and edit it to point to the kickstart file.

6. Install via PXE

Configure the virtual machines to use the custom network (VMnet4), set the BIOS to boot from network first, and start the client.

The client loads the kernel and initrd via TFTP, retrieves the kickstart file via HTTP, performs automatic partitioning, package installation, and completes the CentOS 6.5 installation without manual intervention.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

HTTPPXECentOSKickstartDHCPTFTP
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.