Configuring basic pxeboot server

From Notes_Wiki
Revision as of 11:36, 2 December 2012 by Saurabh (talk | contribs)

<yambe:breadcrumb>Pxeboot server configuration</yambe:breadcrumb>

Configuring basic pxeboot server

To configure a basic pxeboot server we can use following steps:

  1. Install packages 'dhcp', 'tftp-server' and 'syslinux'
    yum -y install dhcp tftp-server syslinux
  2. Edit file '/etc/xinetd.d/tftp' and change 'disable' to 'no'.
    disable = no
  3. Start 'xinetd' service and enable it to run on start-up
    service xinetd [re]start
    chkconfig xinetd on
  4. Copy required files from syslinux to tftpboot directory
    cp /usr/lib/syslinux/pxelinux.0 /tftpboot
    cp /usr/lib/syslinux/menu.c32 /tftpboot
    cp /usr/lib/syslinux/memdisk /tftpboot
    cp /usr/lib/syslinux/mboot.c32 /tftpboot
    cp /usr/lib/syslinux/chain.c32 /tftpboot
  5. Create the directory for your PXE menus
    mkdir /tftpboot/pxelinux.cfg
  6. Create a base directory for images. Create directories for each OS release you are supporting
    mkdir -p /tftpboot/images/centos/5.5/x86_64
  7. In each of the folders created above copy files 'vmlinuz' and 'initrd.img' from images/pxeboot directory of OS installation DVD/CD1
  8. Add this to your existing or new '/etc/dhcpd.conf'
    allow booting;
    allow bootp;
    option option-128 code 128 = string;
    option option-129 code 129 = text;
    next-server xxx.xxx.xxx.xxx;
    filename "/pxelinux.0";
    Note:
    • xxx.xxx.xxx.xxx is the IP address of your PXE server.
    • Example dhcpd.conf file:
    option domain-name "iiit.ac.in";
    option domain-name-servers 192.168.36.222, 192.168.36.204;
    ddns-updates off;
    ddns-update-style none;
    allow booting;
    allow bootp;
    option option-128 code 128 = string;
    option option-129 code 129 = text;
    next-server 172.31.1.2;
    filename "/pxelinux.0";
    subnet 172.31.1.0 netmask 255.255.255.0
    {
    authoritative;
    option routers 172.31.1.1;
    max-lease-time 1296000;
    default-lease-time 340000;
    range 172.31.1.100 172.31.1.200;
    }
  9. Restart DHCP server and enable it on startup
    service dhcpd [re]start
    chkconfig dhcpd on
  10. Download DVD or CD ISO images of the OS that we plan to install and host it on HTTP/FTP server the way we do for network installation. This server need not be same as DHCP server or TFTP server but should be reachable via machines which are going to boot using this TFTP server.
  11. If you are mounting ISO images to netinst directory with loopback device then it is best to configure the binding in '/etc/fstab' file so that even after reboot the ISO file gets again mounted on same directory. Sample fstab line may look like
    <iso_file_path> <netinst_dir_path> iso9660 defaults,loop,ro 0 0
  12. Setup menu for pxeboot server by creating file '/tftpboot/pxelinux.cfg/default' with something like
    default menu.c32
    prompt 0
    timeout 300
    ONTIMEOUT local
    MENU TITLE PXE Menu
    LABEL CentOS 5 x86_64 NO KS eth0
    MENU LABEL CentOS 5 x86_64 NO KS eth0
    KERNEL images/centos/x86_64/5.5/vmlinuz
    APPEND ks initrd=images/centos/5.5/x86_64/initrd.img ramdisk_size=100000 ksdevice=eth0 ip=dhcp url --url http://172.31.1.2/operating_systems/centos/5.5/x86_64/netinst/
    LABEL CentOS 5 x86_64 NO KS eth1
    MENU LABEL CentOS 5 x86_64 NO KS eth1
    KERNEL images/centos/x86_64/5.5/vmlinuz
    APPEND ks initrd=images/centos/5.5/x86_64/initrd.img ramdisk_size=100000 ksdevice=eth1 ip=dhcp url --url http://172.31.1.2/operating_systems/centos/5.5/x86_64/netinst/
    Note that two options are created above for single OS and client should choose the appropriate option based on whether client is connected to LAN using eth0 or eth1. If client is connected to LAN using eth2 or some other name then both these options wont work and we would have to either add another option for the client with proper network device name or change the network interface through which client connects to LAN for the installation.

Note that:


<yambe:breadcrumb>Pxeboot server configuration</yambe:breadcrumb>