In this article we will show you how you can configure a PXE server in Ubuntu 14.04.
Configure Networking
To get started, you need to first set up your PXE server to use a static IP. To set up a static IP address in your system, you need to edit the “/etc/network/interfaces” file.
- Open the “/etc/network/interfaces” file. Add/edit as described below: Save the file and exit. This will set its IP address to “192.168.1.20”. Restart the network service.
Install DHCP, TFTP and NFS:
DHCP, TFTP and NFS are essential components for configuring a PXE server. First you need to update your system and install all necessary packages. For this, run the following commands:
Configure DHCP Server:
DHCP stands for Dynamic Host Configuration Protocol, and it is used mainly for dynamically distributing network configuration parameters such as IP addresses for interfaces and services. A DHCP server in PXE environment allow clients to request and receive an IP address automatically to gain access to the network servers.
- Edit the “/etc/default/dhcp3-server” file. Add/edit as described below: Save (Ctrl + o) and exit (Ctrl + x) the file.
- Edit the “/etc/dhcp3/dhcpd.conf” file: Add/edit as described below: Save the file and exit.
- Start the DHCP service.
Configure TFTP Server:
TFTP is a file-transfer protocol which is similar to FTP. It is used where user authentication and directory visibility are not required. The TFTP server is always listening for PXE clients on the network. When it detects any network PXE client asking for PXE services, then it provides a network package that contains the boot menu.
- To configure TFTP, edit the “/etc/inetd.conf” file. Add/edit as described below: Save and exit the file.
- Edit the “/etc/default/tftpd-hpa” file. Add/edit as described below: Save and exit the file.
- Enable boot service for inetd to automatically start after every system reboot and start tftpd service.
- Check status. It will show the following output:
Configure PXE boot files
Now you need the PXE boot file “pxelinux.0” to be present in the TFTP root directory. Make a directory structure for TFTP, and copy all the bootloader files provided by syslinux from the “/usr/lib/syslinux/” to the “/var/lib/tftpboot/” path by issuing the following commands: Set up PXELINUX configuration file The PXE configuration file defines the boot menu displayed to the PXE client when it boots up and contacts the TFTP server. By default, when a PXE client boots up, it will use its own MAC address to specify which configuration file to read, so we need to create that default file that contains the list of kernels which are available to boot. Edit the PXE Server configuration file with valid installation options. To edit “/var/lib/tftpboot/pxelinux.cfg/default,” Add/edit as described below: Save and exit the file. Edit the “/var/lib/tftpboot/pxelinux.cfg/pxe.conf” file. Add/edit as described below: Save and exit the file.
Add Ubuntu 14.04 Desktop Boot Images to PXE Server
For this, Ubuntu kernel and initrd files are required. To get those files, you need the Ubuntu 14.04 Desktop ISO Image. You can download the Ubuntu 14.04 ISO image in the /mnt folder by issuing the following command: Note: the download URL might change as the ISO image is updated. Check out this website for the latest download link if the above URL is not working. Mount the ISO file, and copy all the files to the TFTP folder by issuing the following commands:
Configure NFS Server to Export ISO Contents
Now you need to setup Installation Source Mirrors via NFS protocol. You can also use http and ftp for Installation Source Mirrors. Here I have used NFS to export ISO contents. To configure the NFS server, you need to edit the “/etc/exports” file. Add/edit as described below: Save and exit the file. For the changes to take effect, export and start NFS service. Now your PXE Server is ready.
Configure Network Boot PXE Client
A PXE client can be any computer system with a PXE network boot enable option. Now your clients can boot and install Ubuntu 14.04 Desktop by enabling “Boot From Network” options from their systems BIOS. You’re now ready to go – start your PXE Client Machine with the network boot enable option, and you should now see a sub-menu showing for your Ubuntu 14.04 Desktop that we created.
Conclusion
Configuring network boot installation using PXE server is efficient and a time-saving method. You can install hundreds of client at a time in your local network. All you need is a PXE server and PXE enabled clients. Try it out, and let us know if this works for you. Reference: PXE Server wiki PXE Server Ubuntu Image credit: fupsol_unl_20