dotlinux blog

Setting Up Prerequisites to ‘Install Windows 7’ over ‘PXE Network Boot Server’ on RHEL/CentOS 7

Installing an operating system via a network boot is a powerful technique, especially in enterprise environments or for system administrators managing multiple machines. Preboot Execution Environment (PXE) allows a client computer to boot and install an OS from a network server before its primary operating system is even loaded. While installing Linux over PXE is a common and well-documented practice, installing an older Windows version like Windows 7 presents a unique set of challenges. Windows uses different protocols and requires specific files that are not natively supported by standard Linux PXE servers.

This detailed guide will walk you through the prerequisites and initial setup required on your RHEL or CentOS 7 server to enable a PXE-based installation of Windows 7. We will configure a robust foundation comprising a DHCP server to assign IP addresses, a TFTP server to deliver the initial boot files, and a Samba share to host the actual Windows installation source files. By the end of this blog, your server will be ready to serve the necessary boot files to a client, setting the stage for the actual Windows 7 installation process in a subsequent guide.

2026-05

Table of Contents#

  1. Prerequisites
  2. Step 1: Installing Necessary Packages
  3. Step 2: Configuring the DHCP Server (dhcpd)
  4. Step 3: Setting Up the TFTP and HTTP Service
  5. Step 4: Preparing the Windows 7 Installation Source
  6. Step 5: Configuring Firewall and SELinux
  7. Step 6: Enabling and Starting Services
  8. Conclusion & Next Steps
  9. References

Prerequisites#

Before you begin, ensure you have the following:

  • A system running RHEL (Red Hat Enterprise Linux) 7 or CentOS 7 with a static IP address (e.g., 192.168.1.10). This will be our PXE server.
  • Root or sudo privileges on the server.
  • A Windows 7 ISO image.
  • A basic understanding of networking concepts (IP addresses, subnets).
  • A client machine that supports PXE boot (check BIOS/UEFI settings).

Important Network Note: For simplicity, this guide assumes the PXE server is running on a network where it can act as the DHCP server. If there is already a DHCP server on your network, you will need to configure it with specific options (next-server, filename) instead of installing a new one, to avoid conflicts. This is often referred to as setting up a "DHCP Proxy" or using IP Helper addresses on network switches/routers.


Step 1: Installing Necessary Packages#

We need to install the packages that will provide the DHCP, TFTP, and file sharing services. The EPEL repository is required for some additional tools.

# Enable EPEL repository
yum install epel-release -y
 
# Update the system
yum update -y
 
# Install the required packages
yum install dhcp syslinux tftp-server httpd samba samba-client samba-common -y
  • dhcp: The DHCP server daemon.
  • syslinux: Contains the PXE bootloader files (like pxelinux.0).
  • tftp-server: The Trivial File Transfer Protocol server for serving boot files.
  • httpd / samba: We will use one of these to host the Windows installation files. Samba is the more traditional choice for Windows files, but a modern setup can use HTTP. We will set up Samba in this guide.

Step 2: Configuring the DHCP Server (dhcpd)#

The DHCP server is crucial as it tells the PXE client where to find the boot files.

  1. Edit the DHCP configuration file:

    vi /etc/dhcp/dhcpd.conf
  2. Add the following configuration, adjusting the network settings to match your environment:

    # /etc/dhcp/dhcpd.conf
    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 192.168.1.0 netmask 255.255.255.0 {
      range 192.168.1.100 192.168.1.200;
      option domain-name-servers 8.8.8.8;
      option routers 192.168.1.1;
      default-lease-time 600;
      max-lease-time 7200;
      # PXE Server IP (this machine)
      next-server 192.168.1.10;
      # Path to the PXE bootloader
      filename "pxelinux.0";
    }
    • subnet, range, routers: Configure these to match your network.
    • next-server: Must be the static IP address of your RHEL/CentOS PXE server.
    • filename: Tells the client the initial file to request via TFTP.

Step 3: Setting Up the TFTP and HTTP Service#

The TFTP server will hold the small boot files, while the Windows installation source will be on a Samba share.

  1. Configure TFTP Service:

    • Edit the TFTP configuration file to enable the service and set the root directory.
    vi /etc/xinetd.d/tftp
    • Change the disable line to no and ensure the server_args point to /var/lib/tftpboot.
    service tftp
    {
            socket_type             = dgram
            protocol                = udp
            wait                    = yes
            user                    = root
            server                  = /usr/sbin/in.tftpd
            server_args             = -s /var/lib/tftpboot
            disable                 = no
            per_source              = 11
            cps                     = 100 2
            flags                   = IPv4
    }
  2. Populate the TFTP Directory:

    • Copy the necessary bootloader files from the syslinux package.
    mkdir -p /var/lib/tftpboot
    cp -v /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
    cp -v /usr/share/syslinux/vesamenu.c32 /var/lib/tftpboot/
    cp -v /usr/share/syslinux/ldlinux.c32 /var/lib/tftpboot/
    cp -v /usr/share/syslinux/libcom32.c32 /var/lib/tftpboot/
    cp -v /usr/share/syslinux/libutil.c32 /var/lib/tftpboot/
    • Create the directory structure for the PXE configuration menu.
    mkdir -p /var/lib/tftpboot/pxelinux.cfg

Step 4: Preparing the Windows 7 Installation Source#

Windows cannot be installed directly from the ISO over TFTP. We need to extract the files and make them available via a network share.

  1. Mount the Windows 7 ISO:

    mkdir -p /mnt/win7_iso
    mount -o loop /path/to/your/windows7.iso /mnt/win7_iso
  2. Create a Directory and Copy Files:

    mkdir -p /var/www/html/win7_source  # If using HTTP
    # OR, for Samba (recommended for this guide)
    mkdir -p /srv/samba/win7_source
    cp -r /mnt/win7_iso/* /srv/samba/win7_source/
  3. Configure Samba Share:

    • Edit the Samba configuration file.
    vi /etc/samba/smb.conf
    • Add the following share definition at the end of the file:
    [win7_source]
            comment = Windows 7 Installation Source
            path = /srv/samba/win7_source
            public = yes
            writable = no
            browsable = yes
            guest ok = yes
            read only = yes
    • Set appropriate permissions on the directory.
    chmod -R 755 /srv/samba/win7_source/
    chown -R nobody:nobody /srv/samba/win7_source/

Step 5: Configuring Firewall and SELinux#

We need to open the necessary ports for the services to function.

  1. Configure FirewallD:

    firewall-cmd --permanent --add-service=dhcp
    firewall-cmd --permanent --add-service=tftp
    firewall-cmd --permanent --add-service=http  # If using HTTP for the source
    firewall-cmd --permanent --add-service=samba
    firewall-cmd --reload
  2. Configure SELinux (Important!):

    • SELinux will block the TFTP and Samba services from accessing files by default. We need to set the correct contexts.
    # For TFTP directory
    semanage fcontext -a -t tftpdir_t "/var/lib/tftpboot(/.*)?"
    restorecon -R /var/lib/tftpboot
     
    # For Samba share directory
    semanage fcontext -a -t samba_share_t "/srv/samba/win7_source(/.*)?"
    restorecon -R /srv/samba/win7_source
     
    # Set Booleans
    setsebool -P tftp_home_dir on
    setsebool -P samba_export_all_ro on

Step 6: Enabling and Starting Services#

Now, let's enable the services to start at boot and start them immediately.

# Enable services
systemctl enable dhcpd
systemctl enable xinetd  # This controls tftp
systemctl enable smb
systemctl enable nmb
 
# Start services
systemctl start dhcpd
systemctl start xinetd
systemctl start smb
systemctl start nmb
 
# Check their status to ensure they are running without errors
systemctl status dhcpd
systemctl status xinetd
systemctl status smb

Conclusion & Next Steps#

Congratulations! You have successfully set up all the prerequisites on your RHEL/CentOS 7 server to install Windows 7 over PXE. At this point, your server is capable of:

  1. Assigning an IP address to a PXE client (DHCP).
  2. Serving the initial bootloader pxelinux.0 (TFTP).
  3. Hosting the complete Windows 7 installation source files (Samba).

The next critical steps, which will be covered in a follow-up guide, involve:

  1. Acquiring the Windows PE Boot Image: You will need the boot.wim and boot.sdi files from the sources directory of a Windows Automated Installation Kit (WAIK) or Windows Assessment and Deployment Kit (ADK). These are essential for creating a Windows Preinstallation Environment (WinPE) that can boot over the network.
  2. Creating the PXE Configuration Menu: You will create a configuration file (e.g., /var/lib/tftpboot/pxelinux.cfg/default) that tells the bootloader how to load the Windows PE image and where to find the installation files on the Samba share.

Your server is now the foundation. The next phase is building the Windows-specific boot mechanism on top of it.

References#

  1. Red Hat Documentation - Managing DHCP
  2. Syslinux Wiki - PXELINUX
  3. Samba Official Documentation
  4. Microsoft Docs - Windows ADK (For acquiring boot.wim in the next steps)
  5. Red Hat Documentation - SELinux