PXE installation

Configuring a TFTP-PXE Server « Linux In Novell’s East Region

Pre-eXecution Environment (PXE) is a method of booting computers off of a network card independent of local storage devices such as a hard drive or a DVD. PXE is very useful in thin client environments or as a quick way to deploy a new operating system to any computer. PXE is dependent on several network protocols:

Setting up a TFTP server will allow you to easily deploy operating systems to machines without having to boot them from a CD or a DVD. Since most, if not all, laptops have an auto-sensing NICs these days, it is very convenient to setup a TFTP server on your machine. This will allow you to connect your laptop to another machine by a standard Ethernet cable and deploy a new operating system. If your machine doesn’t have an auto-sensing NIC you can use a Ethernet crossover cable or a switch/hub.

All of the components required for setting up a TFTP server are included in SUSE Linux Enterprise Server (SLES). While unsupported, you can install the necessary component packages from SLES on a SUSE Linux Enterprise Desktop (SLED).

A TFTP server requires the following things:

DHCP. Before a PXE booted machine can do anything it needs to get an IP address. This means you must setup a DCHP server. Go into the YaST Software Management module and install the “DHCP and DNS Server” pattern. This includes DCHP, dhcp6, DCHP-relay, DCHP-server, DCHP-tools. Next configure your /etc/dhcpd.conf file. Here is what mine looks like:
default-lease-time 14400;
ddns-update-style none;
subnet 192.168.2.0 netmask 255.255.255.0 {
option domain-name-servers 192.168.2.50;
default-lease-time 14400;
filename "pxelinux.0";
next-server 192.168.2.50;
max-lease-time 172800;
range 192.168.2.51 192.168.2.160;
}

The key values for PXE booting are “filename” and “next-server”. Pxelinux.0 is a SYSLINUX derivative, for booting Linux off a network server, using a network ROM conforming to the Intel PXE specification. We will discuss more in a bit. For more information visit here. Next-server defines the IP address of the TFTP boot server. In this case the DHCP server and TFTP server are running on the same machine. Next we will have to configure a static IP address on our machine so that it matches the next-server value. In this example that address is 192.168.2.50 and the subnet mask is 255.255.255.0. To setup a static IP address go into YaST and choose the “network card” module. Restart or start your DCHP server by running rcdhcpd start or rcdhcpd restart

ATFP: There isn’t much that needs to be configured beyond the defaults. Here is my /etc/sysconfig/atftpd file:

## Path: Network/FTP/Atftpd
## Description: ATFTP Configuration
## Type: string
## Default: "--daemon "
#
# atftpd options
#
ATFTPD_OPTIONS="--daemon --no-multicast" #I use --no-multicast to increase reliability of blasting down KIWI images, but it is not necessary
 

## Type: yesno
## Default: no
#
# Use inetd instead of daemon
#
ATFTPD_USE_INETD="no"
## Type: string
## Default: "/tftpboot"
#
# TFTP directory must be a world readable/writable directory.
# By default /tftpboot is assumed.
#
ATFTPD_DIRECTORY="/tftpboot"
## Type: string
## Default: ""
#
# Whitespace seperated list of IP addresses which ATFTPD binds to.
# One instance of the service is started on each IP address.
# By default atftpd will listen on all available IP addresses/interfaces.
#
ATFTPD_BIND_ADDRESSES=""
 

Note that the default location of of the ATFTP directory is /tftpboot. Start/restart ATFTP by entering atftpd start or atftpd restart

/tftptpboot is the directory where you store all the files necessary for PXE booting a machine. My /tftpboot directory contains the following files and directories:

-rw-r--r-- 1 root root 13148 Jul 11 06:35 pxelinux.0
drwxr-xr-x 2 root root 4096 Sep 24 16:33 pxelinux.cfg/
drwxr-xr-x 2 root root 4096 Jul 11 06:36 sled10x86/
 

Let’s address each of these files and directories individually.

pxelinux.0: We addressed this file previously in the dhcp section. You can get this file from /usr/share/syslinux/pxelinux.0

pxelinux.cfg: This directory contains a file named “default”. Here is the contents of my default file:
prompt 1 #this will bring up a boot prompt on the PXE booted machine and force the user to enter the label of the system they want to boot into. This a a good way to prevent people from accidentally blowing away their computer.
# sled10
label sled10 #enter this label (sled10) into the boot prompt
kernel /sled10x86/linux
append initrd=/sled10x86/initrd install=http://192.168.2.50/install/sled10x86 splash=silent showopts
 

By utilizing “prompt 1″ you can setup several different installation environments (SLES, SLED, openSUSE, SLE ThinClient etc.) To do this add multiple enteries. Each entry should point to the correct initrd, linux and installation source for that system. Each label should be unique.

sled10x86: This directory contains two files:

You can get these files off of the SLED or SLES installation dvd in /media/boot/i386/loader/. Simply copy over the initrd and linux files to your /tftpboot/sled10x86 directory.

Installation source: As seen in the /tftpboot/pxelinux.cfg/default file we point to an installation source hosted on the same machine (install=http://192.168.2.50/install/sled10x86 splash=silent showopts)

At this point you should be able to pxe boot a machine off of your laptop or desktop. Make sure that the machine to be PXE booted supports PXE and has it enabled in the BIOS. Some computers will refer to it as “network boot”. On most machines hitting F12 after powering on will force the machine to PXE boot. After the machine PXE boots enter “sled10″ at the boot prompt, hit enter, and then go forward with your installation.

Linux In Novell's East Region

PXE Server on SLES 11 - OS and Applications - Wiki - OS and Applications - Dell Community

Tutorial - openSUSE Network Install over PXE-Boot Part I | Spirit

Tutorial - openSUSE Network Install over PXE-Boot Part II | Spirit

DrDan's Blog

Setting up a PXE installation of SUSE Linux