|
Wer einen Linux LAN Server in seinem lokalen Netz für Druck- und Speicherdienste bereitstellt kann den auch gut dazu benutzen, um den LAN Clients verschiedene Linux Live Distributionen zum Booten anzubieten. Ausserdem natürlich auch InstallationsImages um den Clients die nächste Distributionsversionzum Installieren anzubieten. Wenn mal ein Client Probleme haben sollte läßt sich damit auch schnell ein RescueSystem booten.
Mein PXE Server ist ein OpenSuSE 11.4 und bietet die Installation von openSuSE 11.4 32 und 64 Bit an sowie die LiveCD Installation von Linux Mint LMDE und LXDE. Des weiteren werden biostests, ein rescue system sowie memorytest angeboten. Auf den folgenden Seiten beschreibe ich im Detail, wie man seinen Server konfigurieren muss um aus ihm einen PXE Boot Server zu machen. Damit der eigene Aufbau eines PXE Servers schneller geht stehen alle meine dazu notwendigen Konfigurationsdateien hier zum Download zur Verfügung.
Diese Seite wurde im Mai 2007 initial erstellt und im Mai 2011 mit wesentlich mehr Info erweitert.
===> English <===
If you have a Linux LAN server in your home network to provide printing and storage services you also can use this server to offer different operting systems to your clients with a PXE boot serevr. This can be liveCD images which can be started and used immediately or installation images so your clients can upgrade to the next distro release easily. Rescue live CDs are also useful if there are any client issues.
My PXE server runs openSuSE 11.4 and offers the installation image of openSuSE 11.4 (32 and 64 bit) and Mint LiveCDs of LXDE and LMDE. Furthermore a biostest, rescue system and memorytest is available. The following pages describe in detail how to configure your serve. In addition all the relevant config files of my server are available for download.
This page way create in May 2007 initially an in May 2011 improved with much more details.
===> For English click here <===
Folgende Voraussetzungen müssen erfüllt sein:
- Installiertes syslinux Paket
- Konfigurierter DHCP Server
- Konfigurierter tftp Server incl xinetd Konfiguration
- LiveCD kernel- und initrd Dateien
- Für Netzwerkinstallationen ist noch
- ein konfigurierter nfs Server notwendig
- die InstallationsQuellen
Also habe ich alle o.g. Pakete installiert. Danach habe ich die jeweiligen ISO images von openSuSE 11.4 32 und 64 bit, Linux Mint LXDE und LMDE runtergeladen und auf dem Server abgelegt. Damit diese ISOs im Dateisystem verfügbar sind musste ich in der /etc/fstab für jedes ISO eine weitere Zeile aufnehmen:
/disks/vol1/IsoImages/openSUSE-11.4-DVD-i586.iso /export/SuSE11.4 iso9660 loop
Diese Zeilen sorgen dafür, dass die ISOs im Filesystem unter /export zur Verfügung stehen.
Danach müssen diese per nfs in der /etc/exports exportiert werden:
/export/SuSE11.4 *(ro,no_root_squash,async,no_subtree_check)
Der Inhalt meiner /etc/exports steht hier zu Download bereit.
Ausserdem habe ich MINT LiveCDs runtergeladen und ebenso in die /etc/fstab aufgenommen. Danach müssen die initrd und die kernel Datei vom gemounteten iso ins tftp Verzeichnis kopiert
werden. Diese befinden sich bei Mint im Verzeichnis casper und bei openSuSE im Verzeichnis /boot/i386/boot/loader.
Der Inhalt meiner /etc/fstab steht hier zu Download bereit.
Mein tftpboot Verzeichnis sieht jetzt also wie folgt aus:
idefix:/tftpboot # ls -alRh
.:
total 50M
drwxr-xr-x 7 root root 4.0K May 6 20:14 .
drwxr-xr-x 25 root root 4.0K May 6 18:54 ..
drwxr-xr-x 2 root root 4.0K May 5 20:27 LMDE
drwxr-xr-x 2 root root 4.0K May 5 19:34 LXDE
-r--r--r-- 1 root root 2.0M Feb 27 18:08 biostest
-r--r--r-- 1 root root 33M Feb 27 18:08 initrd
-r--r--r-- 1 root root 3.9M Feb 27 18:08 linux
-r--r--r-- 1 root root 162K Feb 27 18:08 memtest
-r--r--r-- 1 root root 514 May 6 19:41 message
-rw-r--r-- 1 root root 17K Oct 24 2009 pxelinux.0
drwxr-xr-x 2 root root 4.0K May 6 19:37 pxelinux.cfg
-r--r--r-- 1 root root 12M Feb 27 18:08 rescue
drwxr-xr-x 2 root root 4.0K May 6 19:38 suse32
drwxr-xr-x 2 root root 4.0K May 5 21:09 suse64
./LMDE:
total 16M
drwxr-xr-x 2 root root 4.0K May 5 20:27 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 11M Nov 5 13:01 initrd.lz
-r--r--r-- 1 root root 4.1M Sep 20 2010 vmlinuz
./LXDE:
total 20M
drwxr-xr-x 2 root root 4.0K May 5 19:34 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 16M Mar 11 14:02 initrd.lz
-r--r--r-- 1 root root 4.1M Mar 11 14:02 vmlinuz
./pxelinux.cfg:
total 12K
drwxr-xr-x 2 root root 4.0K May 6 19:37 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 1.2K May 6 19:37 default
./suse32:
total 37M
drwxr-xr-x 2 root root 4.0K May 6 19:38 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 33M Feb 27 18:08 initrd
-r--r--r-- 1 root root 3.9M Feb 27 18:08 linux
./suse64:
total 37M
drwxr-xr-x 2 root root 4.0K May 5 21:09 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 33M Feb 27 18:10 initrd
-r--r--r-- 1 root root 4.1M Feb 27 18:10 linux
Jetzt muß der tftp Server konfiguriert werden.
cp -a /usr/share/syslinux/pxelinux.0 /tftpboot
cd /disks/vol2/IsoImages/openSuSE/InstDir/boot/i386/loader
cp -a linux initrd message memtest /tftpboot
cp -a isolinux.cfg /tftboot/pxelinux.cfg/default
Dann müssen noch ein paar Zeilen in der /tftpboot/pxlinux.cfg/default Datei eingefügt werden für alle BootImages, die bereitgestellt werden.
Der Inhalt meiner /tftpboot/pxelinux.cfg/default steht hier zu Download bereit.
# hard disk
label harddisk
localboot 0x80
# install
label suse64
kernel suse64/linux
append initrd=suse64/initrd splash=silent showopts insmod=e100 install=nfs://192.168.0.5/export/SuSE11.464 vga=791
label suse32
kernel suse32/linux
append initrd=suse32/initrd splash=silent showopts insmod=e100 install=nfs://192.168.0.5/export/SuSE11.4 vga=791
label LXDE
kernel LXDE/vmlinuz
append boot=casper initrd=LXDE/initrd.lz ip=dhcp showmounts file=/cdrom/preseed/mint.seed netboot=nfs nfsroot=192.168.0.5:/export/LXDE quiet splash --
label LMDE
kernel LMDE/vmlinuz
append boot=casper initrd=LMDE/initrd.lz ip=dhcp showmounts file=/cdrom/preseed/mint.seed netboot=nfs nfsroot=192.168.0.5:/export/LMDE quiet splash --
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# mediacheck
label mediachk
kernel linux
append initrd=initrd splash=silent mediacheck=1 showopts
# bios test
label firmware
kernel linux
append initrd=biostest,initrd splash=silent install=exec:/bin/run_biostest showopts
# memory test
label memtest
kernel memtest
default LMDE
display message
implicit 0
prompt 1
timeout 0
Nun muss noch die MessageDatei /tftpboot/message vom PXE erweitert werden so dass ein Client sieht, welche Bootimages zur Verfügung stehen:
Der Inhalt meiner /tftpboot/messages steht hier zu Download bereit.
^L
*** Welcome to Idefix ***
To start the installation select a boot option and press <return>.
Available boot options:
harddisk - Boot from Hard Disk (this is default)
suse32 - Install openSuSE 11.4 32 bit
suse64 - Install openSuSE 11.4 64 bit
LXDE - Start Mint LXDE live system
LMDE - Start Mint LMDE live system
rescue - Rescue System
mediachk - Check Installation Media
firmware - Firmware Test
memtest - Memory Test
Have a lot of fun...
Nun muss noch der installierte DHCP Server konfiguriert werden. Die folgenden Zeilen müssen den lokalen Gegebenheiten noch angepasst werden, d.h. das Subnetz (192.168.0.0/255.255.255.0 in meinem Netz), der DNS Server (192.168.0.1 in meinem Netz) sowie das Gateway (option routers 192.168.0.1 in meinem Netz) sowie die IP Adresse des pxe BootServers (192.168.0.5 in meinem Netz).
Der Inhalt meiner /etc/dhcpd.conf steht hier zu Download bereit.
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.200 192.168.0.210;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
filename "pxelinux.0"; # syslinux boot image
next-server 192.168.0.5; # ip adress of tftp server
}
Nun muss noch der tftp Server im xinetd eingeschaltet werden in der /etc/xinet.d/tftp:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
flags = IPv6 IPv4
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
}
Danach den xinetd sowie den dhcp auf dem Server starten und dann PXE Client starten und openSuSE installieren oder MINT LiveCDs über das Netz starten.
Backgroundinfo: Der Ablauf bei PXE ist wie folgt:
- Das PXE-Bootrom initialisiert die Netzwerkarte und sendet eine
DHCP-Anfrage.
- Der DHCP-Server antwortet, indem er eine IP-Adresse und den Namen
des zu ladenden NBPs (Network Bootstrap Program) zurück schickt (pxelinux.0)
- Das PXE-Bootrom lädt das NBP herunter, platziert es im Speicher und
beginnt mit dessen Ausführung.
- Das NBP nutzt tftp, um die Konfigurationsdatei vom Server herunter
zu laden (nfs://192.168.0.6/SuSE)
- Die Konfigurationsdatei enthält den Namen des Kernels, den Namen
der Initial-RAMdisk-Datei und Optionen, welche dem Kernel übergeben
werdn nachdem dieser geladen ist.
- Das NBP benutzt nun tftp, um den Linux-Kernel und die
Initial-RAMdisk-Datei (initrd) herunter zu laden.
- Die Kontrolle wird dann an den Linux-Kernel gegeben. Dieser bootet,
mountet das initrd-Image und setzt dann das Starten des Thin Clients
fort.
References
A PXE boot server has following prerequisites:
- Installed syslinux Paket
- Configured DHCP Server
- Configured tftp Server including xinetd config for tftp
- LiveCD kernel- and initrdfiles
- For a network installation like openSuSE
- a configured nfs server
- the installation images
First of all you have to install all then packages mentioned above. Then I downloadedall the ISO images for openSuSE 11.4 32 and 64 bit, Linux Mint LXDE and LMDE and stored them on the server. Then you have to add one line in /etc/fstab for every IS:
/disks/vol1/IsoImages/openSUSE-11.4-DVD-i586.iso /export/SuSE11.4 iso9660 loop
Then you can access the contents of the ISO file in the directory /export.
Now these directories have to be exported as nfs in /etc/exports(Only needed for openSuSE installation ISO images).
/export/SuSE11.4 *(ro,no_root_squash,async,no_subtree_check)
My /etc/exports can be downloaded here.
For MINT LiveCDs you have to copy initrd and kernel files from the mountes iso into the tftp directory. You find them in the mint directories casper. For openSuSE you have to look into /boot/i386/boot/loader.
My /etc/fstab can be downloaded here.
Finally the tftp directory looks like the following ls output:
idefix:/tftpboot # ls -alRh
.:
total 50M
drwxr-xr-x 7 root root 4.0K May 6 20:14 .
drwxr-xr-x 25 root root 4.0K May 6 18:54 ..
drwxr-xr-x 2 root root 4.0K May 5 20:27 LMDE
drwxr-xr-x 2 root root 4.0K May 5 19:34 LXDE
-r--r--r-- 1 root root 2.0M Feb 27 18:08 biostest
-r--r--r-- 1 root root 33M Feb 27 18:08 initrd
-r--r--r-- 1 root root 3.9M Feb 27 18:08 linux
-r--r--r-- 1 root root 162K Feb 27 18:08 memtest
-r--r--r-- 1 root root 514 May 6 19:41 message
-rw-r--r-- 1 root root 17K Oct 24 2009 pxelinux.0
drwxr-xr-x 2 root root 4.0K May 6 19:37 pxelinux.cfg
-r--r--r-- 1 root root 12M Feb 27 18:08 rescue
drwxr-xr-x 2 root root 4.0K May 6 19:38 suse32
drwxr-xr-x 2 root root 4.0K May 5 21:09 suse64
./LMDE:
total 16M
drwxr-xr-x 2 root root 4.0K May 5 20:27 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 11M Nov 5 13:01 initrd.lz
-r--r--r-- 1 root root 4.1M Sep 20 2010 vmlinuz
./LXDE:
total 20M
drwxr-xr-x 2 root root 4.0K May 5 19:34 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 16M Mar 11 14:02 initrd.lz
-r--r--r-- 1 root root 4.1M Mar 11 14:02 vmlinuz
./pxelinux.cfg:
total 12K
drwxr-xr-x 2 root root 4.0K May 6 19:37 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 1.2K May 6 19:37 default
./suse32:
total 37M
drwxr-xr-x 2 root root 4.0K May 6 19:38 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 33M Feb 27 18:08 initrd
-r--r--r-- 1 root root 3.9M Feb 27 18:08 linux
./suse64:
total 37M
drwxr-xr-x 2 root root 4.0K May 5 21:09 .
drwxr-xr-x 7 root root 4.0K May 6 20:14 ..
-r--r--r-- 1 root root 33M Feb 27 18:10 initrd
-r--r--r-- 1 root root 4.1M Feb 27 18:10 linux
Now you have to configure the tftp server:
cp -a /usr/share/syslinux/pxelinux.0 /tftpboot
cd /disks/vol2/IsoImages/openSuSE/InstDir/boot/i386/loader
cp -a linux initrd message memtest /tftpboot
cp -a isolinux.cfg /tftboot/pxelinux.cfg/default
Now add some lines in /tftpboot/pxlinux.cfg/default for all bootimages you want to provide via PXE.
My /tftpboot/pxelinux.cfg/default can be downloaded here.
# hard disk
label harddisk
localboot 0x80
# install
label suse64
kernel suse64/linux
append initrd=suse64/initrd splash=silent showopts insmod=e100 install=nfs://192.168.0.5/export/SuSE11.464 vga=791
label suse32
kernel suse32/linux
append initrd=suse32/initrd splash=silent showopts insmod=e100 install=nfs://192.168.0.5/export/SuSE11.4 vga=791
label LXDE
kernel LXDE/vmlinuz
append boot=casper initrd=LXDE/initrd.lz ip=dhcp showmounts
file=/cdrom/preseed/mint.seed netboot=nfs
nfsroot=192.168.0.5:/export/LXDE quiet splash --
label LMDE
kernel LMDE/vmlinuz
append boot=casper initrd=LMDE/initrd.lz ip=dhcp showmounts
file=/cdrom/preseed/mint.seed netboot=nfs
nfsroot=192.168.0.5:/export/LMDE quiet splash --
# rescue
label rescue
kernel linux
append initrd=initrd splash=silent rescue=1 showopts
# mediacheck
label mediachk
kernel linux
append initrd=initrd splash=silent mediacheck=1 showopts
# bios test
label firmware
kernel linux
append initrd=biostest,initrd splash=silent install=exec:/bin/run_biostest showopts
# memory test
label memtest
kernel memtest
default LMDE
display message
implicit 0
prompt 1
timeout 0
Next the message file /tftpboot/message of PXE has to be updated so the clientsget a menu of all the images which can be used.
My /tftpboot/messages can be downloaded here.
^L
*** Welcome to Idefix ***
To start the installation select a boot option and press <return>.
Available boot options:
harddisk - Boot from Hard Disk (this is default)
suse32 - Install openSuSE 11.4 32 bit
suse64 - Install openSuSE 11.4 64 bit
LXDE - Start Mint LXDE live system
LMDE - Start Mint LMDE live system
rescue - Rescue System
mediachk - Check Installation Media
firmware - Firmware Test
memtest - Memory Test
Have a lot of fun...
Last but not least dthe installed DHCP server has to get the following lines but has to be adopted to the local environment, i.e.. the subnet (192.168.0.0/255.255.255.0 in my net), the DNS server (192.168.0.1 in my net) and the gateway (option routers
192.168.0.1 in my net) and finally the IP address of the PXE bootserver
(192.168.0.5 in my net).
My /etc/dhcpd.conf can be downloaded here.
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.200 192.168.0.210;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
filename "pxelinux.0"; # syslinux boot image
next-server 192.168.0.5; # ip adress of tftp server
}
Finally you have to enable the tftp server in xinetd in /etc/xinet.d/tftp:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
flags = IPv6 IPv4
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
}
Now you have to enable the xinet daemon, start the dhcp server and start your PXE clients an can select openSuSE for installation or MINT LiveCDs .
References
|