16.7. Fedora Network Installation via PXE Netboot

You want to netboot your installation, instead of using some sort of physical boot media. Your PCs have network interfaces that support netbooting or Etherboot diskettes, and you have configured the appropriate BIOS settings, so your clients are ready. You have your Fedora-based FTP or HTTP server all set up with a Fedora installation tree. What else do you need to do?

You need a DHCP server and a TFTP server. In this recipe, we'll put them all on the installation server.

Install these packages on your Fedora-based installation server:

	# yum install tftp-server syslinux dhcp

Use this example dhcpd.conf with your own network addressing. next-server is the address of the TFTP server:

	##dhcpd.conf
	allow booting;
	allow bootp;

	subnet 192.168.1.0 netmask 255.255.255.0 {
	          option subnet-mask 255.255.255.0;
	          option broadcast-address 192.168.1.255;
	          range dynamic-bootp 192.168.1.175 192.168.1.240;
	          next-server 192.168.1.40;
	          filename "pxelinux.0";
	}

Next, copy the boot files pxelinux.0, vmlinuz, and initrd.img to the tftpboot directory. If you followed Recipe 16.3, vmlinuz and initrd.img are in /var/www/fedora:

	# cp /usr/lib/syslinux/pxelinux.0 /tftpboot
	# cp /var/www/fedora/isolinux/vmlinuz /tftpboot
	# cp /var/www/fedora/isolinux/initrd.img /tftpboot

If you set up an FTP-based installation server according to Recipe 16.4, your boot files are in /var/ftp/fedora.

Create a minimal tftpboot/pxelinux.cfg file:

	DEFAULT pxeboot
	TIMEOUT 50
	LABEL pxeboot
	      KERNEL vmlinuz
	      APPEND initrd=initrd.img
	ONERROR LOCALBOOT 0

Now, start up everything. Go into /etc/xinetd.d./tftp and change:

	disable = yes

to:

	disable = no

Then, run these commands:

	# chkconfig xinetd on
	# /etc/init.d/xinetd start
	# chkconfig tftp on

Now, you can test it. Install the tftp client on a neighboring PC, and try to connect to the TFTP server:

	$ tftp stinkpad
	tftp> status
	Connected to stinkpad.alrac.net.
	Mode: netascii Verbose: off Tracing: off
	Rexmt-interval: 5 seconds, Max-timeout: 25 seconds

Type a question mark, ?, to see a list of commands. This shows it's running and ready to go.

Power up a PXE-enabled client, which will automatically broadcast DHCPDISCOVER packets extended with PXE-specific options to port UDP 67, and within a few seconds, you should see the familiar Fedora installation screen.

You may use any Linux distribution to power your installation server. You'll have different file locations and package names, but the contents of the configuration files will be the same.

The example dhcpd.conf contains just the options necessary to serve PXE clients. You may add them to your existing DHCP server configuration.

ONERROR LOCALBOOT 0 in pxelinux.cfg means "boot to the local drive if the network boot fails."

You could try the system-config-netboot utility for configuring netbooting, if you prefer a graphical interface. It creates subdirectories under /tftpboot, so you'll have some different file locations.