LINUX PXE: Installing and Network Booting Windows 7, Linux, Solaris using PXE
In this post we'll configure network booting through PXE. PXE stands for Preboot eXecution Environment and has been available for Network Devices (or NIC's) for some time. Such a network boot setup has many uses in particular in OS setup and deployment. In this post I'll introduce the steps to quickly set one up. The only thing required is some patience, persistance and a second NIC (NIC also known as Network or Network Interface Card) card on the second PXE server together with a network cable. Some of the benefits are:
- The target environment where the OS will be installed does not need any external storage devices such as USB or CD/DVD drives.
- There is no CD burning. It is all software based.
- Most motherboards and computers support PXE today.
- You are not limited to a single file size limit in place on some USB devices.
- There's no OS size restrictions. The amount of data available to the boot software is only limited by the amount of free hard disk space on the PXE server.
These are just a few advantages that PXE has and the cost of setup, as we will see, is only time and a little patience.
For this post, I'll simply list the configuration files in place to be used. I'll highlight in each the section that can represent the addition of a new entry to the boot menu with a blue color. The highlighted section would represent the steps to take when adding a new OS to boot. All items in BLUE below represent the changes that would be needed to add a new OS to the choices after this PXE setup is complete.
Here we also have the option of booting Windows 7 but that will be left for another topic.
PXE SETUP
We'll begin by setting up your Linux workstation as a PXE boot server.
Check for required packages. |
Run these or install the latest DHCP, XINETD, HTTPD and TFTP packages for your environment. Most should already come with your distribution. If not, below are some examples to use:
# rpm -qa|grep -i dhcp
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Install a second network card and configure it. |
PXE will need to connect to your server using ethernet. To that end, you need a second network card and a straight through cable. For this step you'll need to install the second network card (Preferrably 100Mbits or higher). The above links also contains instructions on debugging in case you are having problems. In the end, this is what the configuration we will need looks like and what the contents of ifcfg-eth1 should be before proceeding to the next steps (if you already have ifcfg-eth1 create ifcfg-eth2 instead):
# ifconfig eth1 # cd /etc/sysconfig/network-scripts
# cat ifcfg-eth1 NOTE: It is assumed here that eth0 is your primary NIC you already have working and can browse the web with. This tends to be handy. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Setup DHCP on the second NIC. |
Below is the configuration we are going to use so the DHCP server can assign IP addresses to new machines that we will connect:
# cat /etc/dhcp/dhcpd.conf
# Set the default gateway / netmask / broadcast to be used by the PC clients
default-lease-time 43200;
allow booting;
group {
host stb4 {
} Issue: # service dhcpd restart There are a few important sections in each area:
Ensure allow bootp and allow booting is also defined as per above. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The /tftpboot menu files. |
Below is a sample of how I setup mine on my own system: # cat /tftpboot/fcboot.msg (Optional)
?splash.lss
# cat /tftpboot/pxelinux.cfg/default
menu background splash.jpg
F1 vesamenu.c32
label memtest
label s6.1-64 label f14-64
label u10.04-i386
label u11.04-64
LABEL w7 Explanation for a few things is in order:
The boot menu, when loaded, will look like this:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The HTTPD server httpd.conf file. |
The httpd.conf file should contain the locations the installation can retrieve the entire ISO image installation files once selections have been made: # cat /etc/httpd/conf/httpd.conf|tail -n50
.
<Directory /tftpboot/RHEL4-22B>
<Directory /tftpboot/f14-64>
<Directory /tftpboot/s6.1-64>
<Directory /tftpboot/u11.04-64>
<Directory /tftpboot/u10.04-i386> In order for the above new definitions to take effect, you'll need to restart the Apache HTTPD daemon: # service httpd restart Then test by typing the links below into a browser:
Either link should produce a list of files for the distribution. (You'll need to mount the ISO if nothing shows up. See further down for this. The below links even worked for me so would be a good test for your installation if everything is wroking correctly.)
Check the /var/log/httpd/ folder and files for any error messages if it is not working for you. Potentially, the firewall, if you have one, may be blocking content. Adjust it accordingly. You may also need to define which ports and interfaces the Apache HTTPD server listens on: Change /etc/httpd/conf/httpd.conf FROM Listen 80 TO
Listen 80 By default, httpd may already listen on all interfaces defined. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check the /etc/xinetd.d/tftp config file. |
Ensure that your tftp xinetd file is setup correctly. By default, it should already be defined as per below or similar so no changes should be necessary. Below is a sample configuration that worked with the setup in this post. Adjust accordingly to your tastes:
# cat /etc/xinetd.d/tftp To ensure the file is taken into effect, issue: # service xinetd restart Pay close attention to the output messages to ensure everything has restarted and is working correctly. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Download and mount the ISO's you defined menu options for above. |
For this step, I created a short script to mount my ISO's from various sources. I mounted them all under the /tftpboot but stored the ISO's elsewhere on the system:
# cat /tftpboot/mount.ksh
mount -o loop /Files/Ubuntu/ubuntu-11.04-desktop-amd64.iso /tftpboot/u11.04-64/ You'll need to create each of the mount points (BOLD BLACK) to each of the downloaded ISO's (BOLD GREEN) you would like to use. All are mounted using the loopback device (-o loop). |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Add .msg files to make for a user friendly informative menu. (Optional) |
Below is a sample of a .msg file, /tftpboot/http.msg. The ^ NNN characters are special codes that highlight. They can be generated by pressing the CTRL (see below):
^L
^O0fIP : 192.168.1.2^O07
Following this, the system will ask you for the location of the files. Use the where
^O0f<FOLDER>^O07 is the same option that you selected on the opening screen such as CUSTOMIZING THE .MSG FILES There are a couple of characters in the .msg files you may be interested in (Press and hold all three down together or press O while holding ctrl-v down):
CTRL-V-O The ctrl-v-o is followed by '07' or '0f' etc. In fcboot.msg, to display the splash.lss file, use:
^L This will create a customized boot menu for you with an image. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
On the remote machine, enable PXE boot in the boot menu. | Visit your PC or Motherboard manual to enable PXE or pre boot execution on the machine. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Connect and test. |
Ensure your new PC/Server is connected on it's primary NIC to the secondary NIC on your newly configured PXE server.
When given a choice where to obtain installation files from, select HTTP then use one of the HTTP URL's you defined above, and tested with, in the httpd.conf part of the configuration. |
Inevitably, there is always problems with initial setup or any setup. The next page deals with some things you may encounter and their solutions. (Work In Progress)
Cheers!
TK
I dont see any entry for Solaris. Can you help me with setting up PXE server having Solaris and Linux Machines
Hey TuxFreak,
Thank you. Appreciate the feedback. I’d have to write it up from my notes. It’s been on my long to do list for a while. 🙂
Cheers!,
TK
P.S. Great name!
[…] bit belated but …. a bit of PXE on a mobile platform to try different LVM versions in case one doesn’t work and LVM Recovery in […]
Hello,
Now am doing a project.the title is universal remote boot and administration service. The concept is booting operating systems over wider area network.It overcomes the traditional PXE/DHCP/TFTP restrictions….Here the traditional PXE is replaced by PBL(preboot linux) and WBM(wan boot manager)…
where can i get these two exact components?
Also i need the system requirements to do this project..
link for this project: http://ieeexplore.ieee.org/xpls/abs_…=6102270&tag=1
thank you…
[…] and record the output of lvm pvs and lvm lvs. I booted with PXE so could scp the files to the server using scp lvm.pvs.lvs.txt 192.168.0.1:/home/Files/HTPC or […]
[…] PXE Installations: Linux, Solaris, Windows […]