Booting On PXE And On A Customized Debian System
Booting On PXE And On A Customized Debian SystemThis document describes how to boot on a Debian system with a PXE boot. It is not recommended to use this tutorial for many PXE clients, but you can use it for network deployement, for example. The PXE server and client will be running both on Debian Etch 4.0. You can use a crossover cable or boot over a switch. 1. Installing Debian (on the server)1.1 Installing the base systemFollow the excellent tutorial "The Perfect Setup - Debian Etch (Debian 4.0)", the first 2 pages. 1.2 Configuring the networkEdit the file /etc/network/interfaces. vi /etc/network/interfaces And change the file to have something like this:# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.100.1
netmask 255.255.255.0
gateway 192.168.100.254
Change the gateway or adapt the IP configuration to work on your environment. Please change allow-hotplug eth1 to auto eth0 to avoid to lose your network if you reboot your server without network cable (in case of you need to unplug your computer to plug in a crossover cable). 2. Installing the packagesYou must install : - a DHCP server to
enable PXE apt-get install tftpd-hpa dhcp3-server debootstrap nfs-kernel-server 3. Creating the virtual system3.1 Creating a minimal Debian Etch systemIn this section, we will create a folder containing the future system. You will be able to customize this system without changing you PXE server configuration. First, create the base system: mkdir /pxeroot The last command may take a long time depending on your internet connection. It will download a basic Debian system. Then you must configure your network. cp /etc/network/interfaces /pxeroot/etc/network/interfaces And paste this content into the file. This will allow the PXE client to have a dynamic IP address. # Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or # /usr/share/doc/ifupdown/examples for more information. # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp Set the network name: echo pxeboot > /pxeroot/etc/hostname And change the file to have something like this: 127.0.0.1 localhost pxeboot # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts Create the fstab file: cp /etc/fstab /pxeroot/etc/fstab And change the file to look like this: # /etc/fstab: static file system information. # <file system> <mount point> <type> <options> <dump> <pass> /dev/ram0 / ext2 defaults 0 0 proc /proc proc defaults 0 1 tmpfs /tmp tmpfs defaults 0 1 3.2 Customize your virtual systemYou can use the chroot command to customize your system. Simply run: chroot /pxeroot First, you must install a Linux kernel: apt-get install linux-image-386 Some warnings will appear because your system might not be bootable because there is no boot loader on the system (grub, lilo,...). Don't stop the script by answering "no" when it aks if you want to stop the installation. Then simply install the wanted package. In our case, we will run partimage for dumping partition. apt-get install partimage When your configuration is finished, exit the chroot: exit 4 Configuring the DHCP serverNow we need to have a dhcp server to give the address to the PXE client. vi /etc/dhcp3/dhcpd.conf And change the file to have something like this: subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.100 192.168.100.200;
option subnet-mask 255.255.255.0;
filename "pxelinux.0";
next-server 192.168.100.1;
option root-path "192.168.100.1:/pxeroot";
option broadcast-address 192.168.100.255;
}
You can set other options as gateway, dns,... but in our example, we don't need it. Restart the DHCP server when the configuration is finished: /etc/init.d/dhcp-server restart 5 Configuring the TFTP serverSetting up the startup: vi /etc/default/tftpd-hpa And change the file to look like this: RUN_DAEMON="yes" OPTIONS="-l -s /var/lib/tftpboot" Then restart the service: /etc/init.d/tftpd-hpa restart 6 Configuring PXE bootThese commands will create the PXE boot system: cd /var/lib/tftpboot Then paste this into the file: DISPLAY boot.txt2
F1 f1.txt
...
DEFAULT linux
LABEL linux
kernel vmlinuz
append vga=normal initrd=initrd.img ramdisk_size=14332 root=/dev/nfs nfsroot=192.168.100.1:/pxeroot rw --
PROMPT 0
TIIMEOUT 0
You can optionally write a comment visible on boot into /var/lib/tftpboot/boot.txt. 7 Configuring NFSYou must simply export the folder /pxeroot. vi /etc/exports And add this line: /pxeroot 192.168.100.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check) Restart the nfs sever for the changes to take effect: /etc/init.d/nfs-kernel-server restart 8 Starting the computer (on the client)You must check that the network boot is before the other bootable device. When you computer startup, press on "F2", "DELETE" or "F10" depending on your configuration. Find the boot order section then set up the Network boot at the first place. For example here:
|








Recent comments
1 day 12 hours ago
1 day 19 hours ago
2 days 1 hour ago
3 days 2 hours ago
4 days 4 hours ago
4 days 11 hours ago
4 days 13 hours ago
5 days 13 hours ago
1 week 31 min ago
1 week 11 hours ago