More PXE Magic

In this article, I've decided to follow up on a topic I wrote about not in my column directly, but as a feature article called "PXE Magic" in the April 2008 issue. In that article, I talk about how to set up a PXE server from scratch, including how to install and configure DHCP and TFTP. Ultimately, I even provide a basic pxelinux configuration to get you started. Since then, PXE menus with pxelinux have become more sophisticated and graphical and could seem a bit intimidating if you are new to it. In this column, I explain how to piggyback off of the work the Debian and Ubuntu projects have done with their PXE configuration to make your own fancy PXE menu without much additional work. I know not everyone uses Debian or Ubuntu, so if you use a different distribution, hold off on the angry e-mail messages; you still can use the PXE configuration I'm showing here for your distro, provided it gives some basic examples of how to PXE boot its installer. Just use these steps as a launching off point and tweak the PXE config to work for you.

Simple Ubuntu PXE Menu

If this is your first time configuring a PXE server, for the first step, I recommend following my steps in the "PXE Magic" article to install and configure DHCP and TFTP. Otherwise, if you have existing servers in place, just make sure that DHCP is configured to point to your TFTP server (if it's on the same machine, that's fine). And, if you already have any sort of pxelinux configuration in your tftpboot directory, I recommend that you back it up and move it out of the way—I'm going to assume that your entire /var/lib/tftpboot (or /tftpboot on some systems) directory is empty to start with. For the rest of this article, I reference /var/lib/tftpboot as the location to store your PXE configuration files, so if you use /tftpboot, adjust the commands accordingly.

Both Debian and Ubuntu provide a nice all-in-one netboot configuration for each of their releases that makes it simple to PXE boot a particular release yourself. The file is called netboot.tar.gz and is located in a netboot directory along with the rest of the different install images. For instance, the netboot.tar.gz for the i386 Ubuntu 12.04 release (named Precise) can be found at http://us.archive.ubuntu.com/ubuntu/dists/precise/main/installer-i386/current/images/netboot/netboot.tar.gz.

To get started, cd to your tftpboot directory, and then use wget to pull down the netboot.tar.gz file (I'm assuming you'll need root permissions for all of these steps, so I'm putting sudo in front of all of my commands), and then extract the tarball:


$ cd /var/lib/tftpboot
$ sudo wget http://us.archive.ubuntu.com/ubuntu/dists/precise/
↪main/installer-i386/current/images/netboot/netboot.tar.gz
$ sudo tar xzf netboot.tar.gz
$ ls
netboot.tar.gz  pxelinux.0  pxelinux.cfg  
 ↪ubuntu-installer  version.info

As the ls command shows, an ubuntu-installer directory was created along with pxelinux.0 and pxelinux.cfg symlinks that point inside that ubuntu-installer directory to the real files. Without performing any additional configuration, provided your DHCP and TFTP servers were functioning, you could PXE boot a server with this configuration and get a boot menu like the one shown in Figure 1.

Figure 1. Ubuntu Precise PXE Boot Menu

Ubuntu has taken the extra steps of theming its PXE menu with its color scheme and even provided a logo. Unlike the PXE menu I demoed in my previous "PXE Magic" article, this menu functions more like a GUI program. You can use the arrow keys to navigate it, the Enter key to select a menu item and the Tab key to edit a menu entry.

______________________

Kyle Rankin is a director of engineering operations in the San Francisco Bay Area, the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Don't you think it's (way

Anonymous's picture

Don't you think it's (way past) time to do something about all the SPAM in the comments?

Yes

David Lane's picture

Got any good suggestions? Don't forget to click on the "Report Spam" feature so that we can try and keep ahead of it.

David Lane, KG4GIY is a member of Linux Journal's Editorial Advisory Panel and the Control Op for Linux Journal's Virtual Ham Shack

Preseed Enhancement

Anonymous's picture

If you wanted to add a preseed file for installation to a headless server, what would you add?

Preseed

Boethius's picture

In the given append example you'd do the following:

append vga=788 initrd=ubuntu-installer/i386/initrd.gz auto url=http://serverhostingyourpreseedfile/preseedfile.cfg -- quiet

As for the actual preseed file itself, here's an excellent reference for Precise's preseed file:

https://help.ubuntu.com/lts/installation-guide/i386/preseed-contents.html

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState