You are on page 1of 4

Setting up a PXE-Boot Server

This documents how to setup a PXE boot server for Linux. This assumes that you're using Redhat 5.5 as the PXE boot server. The first thing to note is that you may need to setup your own mini-network that is completely disconnected from the network, since part of this process requires setting up a DHCP server which could conflict with the corporate DHCP server if they were both running on the same network simultaneously.

1) The next step is to choose a box to be the PXE boot server. This can really be any box at all, as long as you have a NIC in it that works reliably under Linux. For the purposes of this documentation, I'm going to assume that you've loaded Fedora Core 4 on this box (do that now, if you've not already). Get this box onto the network with DHCP (just like a normal installation). Remember to turn off firewall otherwise set up the pass through port as needed. 2) Next you'll need to install the following packages (which ship with FC4 already, so if you did an 'everything' OS install, you should have them already. If not, you can install them easily with yum): tftp-server dhcp httpd syslinux If you use yum to install them, then it will be generally alot easier: yum install tftp-server dhcp httpd syslinux answer Y to all dependency/installation questions. 3) Now you need to setup the DHCP server. With the FC4 RPM for dhcp, all you need to do is create /etc/dhcpd.conf with the following contents: ddns-update-style interim; ddns-updates on;

subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.10 192.168.0.254; default-lease-time 3600; max-lease-time 4800; option routers 192.168.0.1; option domain-name-servers 192.168.0.1; option subnet-mask 255.255.255.0; option domain-name "pxe.net"; option time-offset -8; } next-server 192.168.0.3; IP of the interface using for tftp is set in step 5 below filename "pxelinux.0"; 4) Next you need to activate tftp within xinetd. All that is neccesary is to change disable=yes to disable=no in /etc/xinetd.d/tftp . Then restart xinetd. For future reference, the tftp RPM for FC4 stores its servable content under /tftpboot. 5) Now we need to setup your PXE server to use a static IP on the new private subnet. Create the file /etc/sysconfig/network-scripts/ifcfg-eth0.static with the following contents: DEVICE=eth0 BOOTPROTO=STATIC ONBOOT=no TYPE=Ethernet IPADDR=192.168.0.3 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 6) Now we need to setup the PXE boot environment on the server. To do this, you need to have either the Linux distribution that you wish to install over PXE either in CD format, or all the content of the CDs available on the network. On the first CD of every RH/FC distribution there is a subdirectory called 'isolinux'. In that directory you will find two files, vmlinuz and initrd.img. These are the kernel & initrd.img that the RH/FC bootable CDs use to get the installer (anaconda) booted for performing the installation. Copy both of those files into /tftpboot and make sure that they are world readable. If you are planning to allow more than one version/distribution to be PXE boot installable, then you should rename both files so that its clear that they are for whatever version/distribution they came from (such as vmlinuz-RHEL5, initrd-RHEL5).

Next, you need the actual pxe boot linux kernel (what is actually run immediately after your PXE boot client box gets a DHCP lease). In this case, that file is pxelinux.0, and is part of the syslinux RPM. For FC4, you can find it at /usr/lib/syslinux/pxelinux.0. Copy that file into /tftpboot and make sure that it is world readable. 7) Next we need to configure pxelinux. First create the directory /tftpboot/pxelinux.cfg Having a default file which is serve as a menu list /tftpboot/pxelinux.cfg/default: prompt 1 default linux timeout 100 label linux kernel vmlinuz append initrd=initrd.img linux dd

8) Now you need to put the full contents of your Linux distro (all CDs) somewhere on disk. I put it under /tftpboot/RHEL5U5. In order to allow for installation over HTTP (apache), edit /etc/httpd/conf/httpd.conf and add the following: <Directory /tftpboot/RHEL5U5> Options Indexes AllowOverride None </Directory> Alias /linux /tftpboot/RHEL5U5

9) At this stage, you're ready to hook up the switch. You should have CAT5 running between the switch & the PXE boot server, and the client box. 10) On the PXE boot server, bring down your DHCP network connected eth0 (ifdown eth0), disconnect the CAT5 connected to the network, and plug in the cat5 connected to your private switch. Now bring up the static IP for the PXE server with (ifup eth0.static). You can verify that it came up successfully by verifying that you have IP address 192.168.0.2 in ifconfig. 11) Now start dhcpd & apache and activate tftp by running the following: TFTP SERVICE VERIFICATION ~~~~~~~~~~~~~~~~~~~~~~~~~

Simply verify your TFTP service and port if they are currently being served and active, like so # netstat -lap | grep ftp # ss -ua | grep tftp

service dhcpd start service xinetd restart service httpd start => Using HTTP server /etc/init.d/nfs restart => Using NFS server and verify that they are all in your process list. 12) Plug the PXE client box's CAT5 into the switch, and verify that the NIC appears first in the BIOS boot order. (re)boot and you should get a DHCP lease, and start booting successfully off the network. 13) When you get into the RH/FC installer which asks you for the install method, choose HTTP. Fill in 192.168.0.2 for the name, and 'linux' for the path, and you should be all set. 14) If you run into any problems, check /var/log/messages for errors (that's where all dhcp & tftp stuff will get logged). /var/log/httpd is where apache logs, but if you get that far, your problem is an apache configuration/setup issue, and not a PXE boot issue.

You might also like