Search This Blog

Thursday, October 13, 2011

How to configure PXE Server in RHEL 6 ?

Server IP settings.

nmcontrolled no
onboot yes

Yum install system-config-kickstart
# Install the kickstart package.

# run the kickstart utility.

In the second last option you can remove text mode installation option and opt For a graphical one. 

Select the http installation method 

Use the defaults. 

In the disk label option choose the first option (Initialize the disk label).
The partitions that I have created are like this.

Mount Point            type         size
/boot         ext4         500
 swap         swap         2048
  /                     ext4         18000

Make sure that SELinux option is disabled and Security level is set to Disable firewall.

Save the ks.cfg file to the filesystem.

Yum install –y syslinux xinetd tftp-server dhcp httpd
# Install all the required packages through yum

mkdir /var/lib/tftpboot/pxelinux.cfg
cp  /usr/share/syslinux/pxelinux.0  /var/lib/tftpboot/

vi /etc/xinetd.d/tftp
# Open the xinetd settings to enable tftp server.
# at line 14 set the parameter to no from yes.
service xinetd restart
# Restart the service to apply the settings made.

chkconfig xinetd on
# set the service to start with each subsequent system reboots.

vi /etc/dhcp/dhcpd.conf
# Open the file and configure the DHCP Server.

# Global Options
Allow booting;
Allow bootp;

# Subnet definition
subnet netmask {
# Parameters for the local subnet
option routers     ;
option subnet-mask ;
option domain-name           “”;
option domain-name-servers;
default-lease-time           21600;
max-lease-time               43200;
# Client IP range
range dynamic-bootp;
filename  “pxelinux.0”;

# Here the next–sever parameter is the address of the kickstart server.

service dhcpd restart
Chkconfig dhcpd on

# restart the service and make it permanent.

mkdir –p /var/pxe/rhel6
mkdir /var/lib/tftpboot/rhel6
# make some required directories.

Insert your RHEL 6 dvd

mount  /dev/cdrom   /mnt
# Mount it to /mnt

ls –l /mnt
# Check the contents to see if it is properly mounted.

cp –ivr /mnt/*  /var/pxe/rhel6
# copy all the contents to the /var/pxe/rhel6 directory.

umount /mnt
# after the file copy operation unmount and eject the dvd.

cp  /var/pxe/rhel6/images/pxeboot/vmlinuz   /var/lib/tftpboot/rhel6
cp  /var/pxe/rhel6/images/pxeboot/initrd.img   /var/lib/tftpboot/rhel6
# copy the vmlinuz and initrd.img files to the tftpboot directory.

cp /usr/share/syslinux/menu.c32  /var/lib/tftpboot/
# copy the menu file.

vi /var/lib/tftpboot/pxelinux.cfg/default

timeout 100
default menu.c32

menu title $$$$$$Boot Menu$$$$$$
label 1
  menu label ^ 1) RHEL6
  kernel rhel6/vmlinuz
  append initrd=rhel6/initrd.img  ks=  ksdevice=eth0

# Prepare the boot menu. 
chkconfig httpd on

vi  /etc/httpd/conf.d/pxeboot.conf

# create new entry

Alias /rhel6 /var/pxe/rhel6

   Options Indexes FollowSymLinks
   Order Deny,Allow
   Deny from all
   Allow from
# Ip address you allow

service httpd restart
(ignore the domain name error if it occurs.)

# Prepare the httpd server

mkdir /var/www/html/ks

cp /ks.cfg   /var/www/html/ks/ks.cfg
chmod 644 /var/www/html/ks/ks.cfg

# make the directory and copy the kickstart file to it.
# and make the kickstart file globally read only.

The pxe server is ready.

Plug a computer into the network and boot it through LAN using pxe.

The client pc should  have a display as below.


  1. MAN!!! u people are awesome was searching for some easy method for configuring PXE boot on RHEL 6. wat so ever i got before this was hell confusing but you gave me easy n interactive method..... thankx a ton n hats off to u...

  2. Awesome .. short and sweet ... A perfect quick start guide for PXE deployment

    1. I followed the above procedure to configure on my RHEL6.2 Machine. I am unable to boot through PXE.
      Its giving error:
      PXE-E18: Server Response timeout

      What should i do? Please reply

    2. I think that you are booting through a client which is using UEFI (Unified Extensible Firmware Interface) instead of BIOS interface.

      From Wikipedia - "The Unified Extensible Firmware Interface (UEFI) is a specification that defines a software interface between an operating system and platform firmware. UEFI is meant as a replacement for the BIOS firmware interface."

      If you can give me the Client and Server Model/Make details i may be able to help you out.

    3. Anonymous, the above assumes you didn't need to add any firewall rules to allow access to the BOOTP server on the system that is hosting it.

      Make sure you have an entry in iptables to allow inbound traffic via port 67/udp ("iptables --list", in case you're trying to recall the command).


  3. hey bro why have you stopped adding rhel 6 tuts??? please add more tuts

  4. Awesome.......A perfect quick start guide for PXE deployment.

  5. Hi..

    I getting "TFTP open timeout" error

    1. Did you specify the "next-server;" option while configuring the dhcpd.conf file?

    2. If it is REDHAT 6 pls disable iptables and try.-pavan

  6. hi friends please anyone help that dhcp configuration step... first am i want copy sample file from /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample? .... after copy file when i edit it global option not available...pls

  7. I would like to add a comment in the above config as i faced a issue while installing with the above procedure.

    vi /etc/httpd/conf.d/pxeboot.conf

    Alias /rhel6 /var/pxe/rhel6

    Options Indexes FollowSymLinks
    #Order Deny,Allow
    #Deny from all
    Allow from

  8. Simply awesome! Nothing else to say!!! :)

  9. Thank you a lot .........

  10. My linux teacher is a dumbass this helps me a lot....

  11. If you copy and paste directly form this tutorial, you may get unexpected results and different types of double quotes are used that Linux may not expect. Also 99% of commands start with lower case so if some of them fail while you follow along, you know why. This is done for proper sentence structure in the tutorial. GREAT tutorial! Just a heads up to any new Linux users out there.

  12. Hats off to you Sir....

  13. hi I have done all step but I m restart the httpd service that time syntax error showing with /etc/httpd/conf.d/pxeboot.conf allow not allowed here.

  14. hi..i am getting error

    uable to retrieve http://ip/rhel6/images/install.img

    please help.


    1. If you follow the instructions as listed above using any version of RHEL with selinux in enforcing mode, you'll have this problem.

      You will need either to label the /var/pxe/rhel6 directory to allow Apache to serve .img files, or disable selinux.

      -Greenie Meanie

  15. Thanks a lot!
    Please note that there is a little correction required to the HTTP "Alias" section. It is missing the "Directory" directive. The functional code is as follows:

    Alias /rhel6 /var/pxe/rhel6

    Options Indexes FollowSymLinks
    Order Deny,Allow
    Deny from all
    Allow from

  16. you are a gem and you made my day. Never stop doing these things mate. Thanks a lot

  17. Hi All, I have followed all the steps above but when I restart the httpd service I get a syntax error saying: /etc/httpd/conf.d/pxeboot.conf allow not allowed here.

  18. Just Solved the issue where there's a syntax error saying: /etc/httpd/conf.d/pxeboot.conf allow not allowed here. Here's the solution:

    vi /etc/httpd/conf.d/pxeboot.conf

    # create new entry

    Alias /rhel6 /var/pxe/rhel6

    options Indexes FollowSymLinks
    order deny,allow
    deny from all
    allow from
    # Ip address you allow

    It will give you an error about the Servername but httpd will start.

  19. Hi,

    It worked like a charm at the first shot.


  20. Hello All, I followed above mentioned steps but still I am getting error like below.
    root@Server2 ~]# service httpd restart
    Stopping httpd: [FAILED]
    Starting httpd: Syntax error on line 4 of /etc/httpd/conf.d/pxeboot.conf:
    order not allowed here
    [root@Server2 ~]#

    I have done settings like same in pxeboot.conf

    Alias /rhel6 /var/pxe/rhel6/

    options Indexes FollowSymLinks
    order deny ,allow
    deny from all
    allow from

    but still getting error. Please let me know how can I figure it out?

  21. Is worked for me thank you very much