Network installing RHEL/CentOS from Windows with PXE

In this article, I describe how to take advantage of a server that supports PXE (most do) to do a network install of Red Hat Enterprise Linux (RHEL) or CentOS from a computer running Windows, without any install media, or even an optical disc drive.

Why a Network Install From Windows?

If you operate a data center, or even a decent sized server room, you’re probably familiar with doing network installs and have your own operating system (OS) image servers already configured. However, what if you’re at home and one of your friends drops off a 1U rack server and asks you to install and configure a Linux OS for him. What do you do?

Do you have an extra SATA DVD drive sitting around the house? How about a SATA power connector splitter, because the optimally designed server has no extras? Do you have any DVD media with the current version of the installation OS on it? If not, do you really want to waste some DVDs and burn it? These are all questions that you don’t even need to answer if you do a network installation. Instead, all you need is a server that supports Preboot Execution Environment (PXE).

PXE extends a computer’s firmware to support booting an operating system from a network interface without the need for any other media storage and retrieval devices such as hard disk drives, CD drives, DVD drives, or USB flash drives. Note that the PXE server has to be on the same broadcast network as the PXE client, because the protocol uses an amalgamation of DHCP and TFTP.

Setting Up the FTP Server

  1. Create a directory at C:\tftp
  2. Download and install the open source FileZilla FTP server.
  3. In FileZilla, click on Edit -> Users and add a user
  4. Specify a Password, click on Shared folders,  Add C:\tftp, and click on OK
  5. Download the OS from the OS repository copying everything from os/arch to directory C:\tftp\os\. The easiest way to do the downloading is to download the OS .iso file and mounting it using an iso virtual drive tool like Virtual CloneDrive.

Setting Up the TFTP and DHCP Server

  1. Download the zip archive of Philippe Jounin’s open source Tftpd32 program and unzip the contents into the C:\tftp directory
  2. Run tftpd32.exe, and click on Settings
  3. On the TFTP tab, check PXE Compatibility and browse to C:\tftp for the Base Directory
  4. On the DHCP tab, uncheck Ping address before assignation and Persistant leases
  5. Enter pxelinux.0 for Boot File, configure your DHCP pool and network information, and click on OK
  6. Download the syslinux RPM from your OS repository
  7. Use Igor Pavlov’s 7-zip to extract the following RPM files from /usr/lib/syslinux into C:\tftp
    chain.c32
    mboot.c32
    memdisk
    menu.c32
    pxelinux.0
  8. Create a text file at C:\tftp\pxelinux.cfg\default containing the following text:
    default menu.c32
    prompt 0
    timeout 300
    ONTIMEOUT localMENU TITLE PXE Menu

    LABEL CentOS 5 x86 NO KS eth0
    MENU LABEL CentOS 5 x86 NO KS eth0
    KERNEL images/vmlinuz
    APPEND ks initrd=images/initrd.img ramdisk_size=100000 ksdevice=eth0

  9. Copy these files from the /images/pxeboot directory of the OS install media from step 5 of setting up the FTP server:
    C:\tftp\images\vmlinuz
    C:\tftp\images\initrd.img

Installing

Note that the pxelinux.cfg file above assumes that you have eth0 set to PXE boot. If you are using a different interface, change the file, otherwise, ensure that the proper interface is set to use PXE by going into the server’s BIOS settings.

Boot the server, and follow the prompts. I recommend doing a server install sans GUI for a server. If you have problems, make sure that your Windows AV/firewall isn’t getting in the way and blocking your TFTP, DHCP, or FTP traffic/service.

I wrote this from memory almost a month after the last time I did this, so if you find mistakes, please let me know and I’m sorry.