Welcome to the new location of Alien's Wiki, sharing a single dokuwiki install with the SlackDocs Wiki.
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | slackware:pxe [2006/09/28 20:17] – Added "next-server" requirement in dhcpd.conf. alien | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== PXE: Installing Slackware over the network ====== | ||
+ | |||
+ | When the time comes to install Slackware on your computer, you have a limited number of options regarding the location of your Slackware packages. Either youinstall them from the (un)official Slackware CDROM or DVD, or you copy them to a pre-existing hard disk partition before starting the installation procedure, or you fetch the packages from a [[slackware: | ||
+ | |||
+ | The number of possible options for booting your Slackware installer is similarly limited: either you boot your computer from the bootable first CDROM of the Slackware CD set, or from the DVD, or (in those cases where the computer BIOS refuses to recognize the CD as bootable) create boot/root floppies and boot from those. There is even loadlin, the DOS based Linux starter, but let's not concern ourselves with the past today. | ||
+ | |||
+ | But what if your PC is lacking a floppy drive - or even a CDROM drive? Brands of PC's are on the market today (ultra-portable laptops for instance) that are unable to install Slackware the traditional way. However, these machines are commonly equipped with network peripherals, | ||
+ | |||
+ | Well, there is one way of booting your computer that the Slackware installer does not __yet__ support. That is the //network boot//. Network boot, or "PXE boot", requires support from your computer' | ||
+ | |||
+ | In this article, I want to present a way of installation that uses the network as the carrier medium, with a server on the local network that holds the boot kernel and the root filesystem (which contains the setup program), and also has all the Slackware packages. This means, there is __no need__ for a floppy or CDROM drive.\\ Be warned: setting it all up is not trivial, and you need more than a beginner' | ||
+ | |||
+ | I will describe how to setup a server with the proper software, and how to modify some of the files on the Slackware CDROM so that PXE-boot becomes a supported installation method for Slackware Linux. | ||
+ | |||
+ | ===== PXE ===== | ||
+ | |||
+ | The commonly used method of booting a computer over the network is called [[wp> | ||
+ | |||
+ | Of course, the other end of the network needs our attention, too. A //PXE server// needs to be available on the local network. The PXE firmware in your computer' | ||
+ | |||
+ | We will cover the requirements for such a server in one of the [[# | ||
+ | |||
+ | The Slackware network installation process will be roughly as follows: | ||
+ | * You start the computer that is going to receive Slackware; | ||
+ | * On startup, you make sure you select //network boot// in the BIOS startup - either by activating a '' | ||
+ | * When the computer boots, the network card activates it's PXE code and tries to contact a PXE server. When such a server exists on the LAN, it will tell the card where to download a piece of bootable code, an Operating System kernel (the Slackware Linux kernel) and an initial ramdisk (aka initrd - the compressed root-filesystem image where the setup program, libraries and kernel modules are stored). You will see a page full of mumbo-jumbo as the card broadcasts on the LAN, and probes for possible candidate configurations to download; | ||
+ | * If a willing PXE server was found, your computer' | ||
+ | * Since we booted the computer using code that did not originate from our computer, we will have to fetch the remainder of the data - the Slackware | ||
+ | * We need to load a kernel driver for our network card and locate a NFS server that holds the Slackware package tree. Currently, NFS is our only means of getting to network data at all. Before starting '' | ||
+ | * From here on, installation proceeds as usual, under the condition that you select //NFS server// as the source of the Slackware packages. | ||
+ | |||
+ | ===== Workstation requirements ===== | ||
+ | |||
+ | As stated before, the requirements for the computer you want to install Slackware on, are as follows: | ||
+ | * network card (non-wireless) with //PXE// firmware, supported by Slackware | ||
+ | * PC BIOS allowing to select //network boot// | ||
+ | No other requirements have to be met for a network install, other than those you'd already have to meet in order to be able to install and run Slackware. | ||
+ | |||
+ | ===== Server requirements ===== | ||
+ | |||
+ | This is the interesting part (well in my opinion at least - many people consider this as a dark art).\\ | ||
+ | A PXE Server is really a mix of several components. We need | ||
+ | * A service that understands the //BOOTP// protocol. BOOTP is a network protocol somewhat like DHCP, and it is used by the PXE firmware to broadcast on the network it's desire to find a suitable server to download the bootstrap code from. The DHCP Server that is part of Slackware fulfills this requirement, | ||
+ | * A download service for the bootstrap code. A //TFTP// (trivial file transfer protocol) server is needed for this. Slackware ships with an implementation of a TFTP server called tftpd-hpa which does what we need. | ||
+ | * And for the Slackware installer, a NFS server is required because we must perform a network install. Slackware does not know the concept of installation from a ftp server (yet?). We can use Slackware' | ||
+ | |||
+ | ===== Implementation of the services ===== | ||
+ | |||
+ | We'll look at how to set up the DHCP, TFTP and NFS services on a Slackware computer so that they work together as a PXE server. | ||
+ | |||
+ | For ease of instruction, | ||
+ | |||
+ | * Our example network uses IP addresses in the range of **'' | ||
+ | |||
+ | * Our network server will have the IP address of **192.168.0.1** and the default gateway is **192.168.0.10**. Server and gateway can be (but do not need to be) the same physical machine. | ||
+ | |||
+ | * The IP address range that the DHCP server will use to lease to DHCP/BOOTP enabled computers is **'' | ||
+ | |||
+ | * The DNS domain will be " | ||
+ | |||
+ | * The server will run all required services, i.e. acts as the LAN's **DNS,DHCP, TFTP and NFS** server. If you decide to separate DHCP and TFTP services onto two different servers (it does not matter where the NFS server runs), I will add a comment on what you should take care of in the [[# | ||
+ | |||
+ | * Directories are used as follows: | ||
+ | * Toplevel of the complete Slackware 11.0 directory tree (excluding the source code if you're short on disk space) is **''/ | ||
+ | * The directory where we store the boot files for the TFTP server is **''/ | ||
+ | |||
+ | ==== DHCP ==== | ||
+ | |||
+ | You probably already have a DHCP server running on your network. You can try and modify it's configuration so that it will do want we want, or if that is impossible (for instance because the DHCP server is running on your DSL/Cable router) you could consider disabling that and setting up a Slackware DHCP server for your LAN with much enhanced functionality. | ||
+ | |||
+ | Slackware includes the //ISC DHCP// server package (dhcpd). Two example ''/ | ||
+ | |||
+ | If you don't want to be bothered with fancy configurations but want a quick solution that will just work for your network, use the [[# | ||
+ | |||
+ | If you know what you're doing and understand (more or less) how the DHCP server works, you can have a look at the second, more complex, ''/ | ||
+ | The rest of this chapter deals with the setup of a //complex// DHCP configuration. | ||
+ | |||
+ | By default, we should no allow network boots in our network (which is safer of course - imagine a computer that does an un-intended network boot and suddenly finds itself running the Slackware installer!). In the ''/ | ||
+ | host t43 { | ||
+ | hardware ethernet 00: | ||
+ | fixed-address 192.168.0.3; | ||
+ | } </ | ||
+ | Nothing spectacular; | ||
+ | group { | ||
+ | allow bootp; | ||
+ | next-server 192.168.0.1; | ||
+ | use-host-decl-names on; | ||
+ | if substring (option vendor-class-identifier, | ||
+ | filename "/ | ||
+ | } | ||
+ | |||
+ | host ABC { | ||
+ | ..... | ||
+ | } | ||
+ | |||
+ | host XYZ { | ||
+ | ..... | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | next-server 192.168.0.254;</ | ||
+ | |||
+ | <note tip>If you are running a version of ISC dhcpd that is >= 3.0.3 , then the addition of a '' | ||
+ | </ | ||
+ | |||
+ | <note tip> | ||
+ | If you are already using **dnsmasq** as your DNS/DHCP server, then the above instructions for the ISC DHCP server are not applicable to your setup. In that case, I have another [[: | ||
+ | </ | ||
+ | |||
+ | ==== TFTP ==== | ||
+ | |||
+ | The tftpd service is managed by inetd. Enable the line for tftpd in the file ''/ | ||
+ | tftp dgram udp wait root / | ||
+ | </ | ||
+ | / | ||
+ | </ | ||
+ | We need to create the directory ''/ | ||
+ | mkdir / | ||
+ | The tftpd service is now configured and running. We just need to populate it's root directory, but I'll keep that for another paragraph. | ||
+ | |||
+ | ==== NFS ==== | ||
+ | |||
+ | For setting up a NFS server, I simply point you to another article in this Wiki: [[slackware: | ||
+ | |||
+ | * You need to export the directory where you keep your local copy of the Slackware packages, for instance by adding this to ''/ | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | * If you had to add this to the ''/ | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | __For simplicity' | ||
+ | |||
+ | * Create a file named ''/ | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | * Use the directory mentioned in ''/ | ||
+ | |||
+ | * Make the NFS server startup script executable so that the NFS server will start on every boot: < | ||
+ | chmod +x / | ||
+ | |||
+ | * Start the NFS server (so you don't have to reboot already): | ||
+ | / | ||
+ | |||
+ | ===== PXELinux configuration ===== | ||
+ | |||
+ | PXELinux is much like // | ||
+ | We will start with the configuration file '' | ||
+ | |||
+ | ==== The tftp directory structure ==== | ||
+ | |||
+ | As you can see in the [[# | ||
+ | This filename ''/ | ||
+ | mkdir / | ||
+ | mkdir / | ||
+ | cp / | ||
+ | </ | ||
+ | cp / | ||
+ | cp / | ||
+ | cp / | ||
+ | </ | ||
+ | cp -a / | ||
+ | </ | ||
+ | |||
+ | ==== Creating an initrd.img ==== | ||
+ | |||
+ | The usual way of installing Slackware from a NFS server repository, is to boot the Slackware CDROM, and run ('' | ||
+ | Now, with a boot from the network we are assuming there is //no CDROM// and //no floppy// drive available to us. So, we need to add all the drivers we need to the root filesystem that the PXElinux bootloader downloads from the TFTP server (contained in the '' | ||
+ | |||
+ | This is the basic procedure - we will carry this out on the server. I still assume your local mirror of the Slackware release can be found under ''/ | ||
+ | * Create a //staging area// where we do all our nifty work: < | ||
+ | mkdir -p / | ||
+ | * Extract the image containing the root filesystem from the compressed file '' | ||
+ | gunzip -cd / | ||
+ | * Loop-mount that image file somewhere in your filesystem, say at ''/ | ||
+ | cd /tmp/pxe | ||
+ | mkdir initrd | ||
+ | mount -o loop,ro initrd.dsk initrd/</ | ||
+ | * Loop-mount the network and pcmcia disk images, too:< | ||
+ | mkdir pcmcia | ||
+ | mount -o loop,ro / | ||
+ | mkdir network | ||
+ | mount -o loop,ro / | ||
+ | </ | ||
+ | * Use the '' | ||
+ | dd if=/ | ||
+ | </ | ||
+ | </ | ||
+ | * We then create a filesystem //inside// this file (and use the '' | ||
+ | mkfs.ext2 -m 0 -F / | ||
+ | tune2fs -i 0 / | ||
+ | </ | ||
+ | * Now that we have a usable filesystem, loop-mount this file as well (this one read/ | ||
+ | mkdir -p / | ||
+ | mount -o loop / | ||
+ | </ | ||
+ | * Copy the contents of the three Slackware disk images into the still empty new file: < | ||
+ | cp -a / | ||
+ | cp -a / | ||
+ | cp -a / | ||
+ | </ | ||
+ | * Modify the scripts that are executed when you type '' | ||
+ | cd //< | ||
+ | cat pcmcia > / | ||
+ | cat network > / | ||
+ | patch -p0 / | ||
+ | </ | ||
+ | * Re-generate the kernel module dependency files: < | ||
+ | gunzip -cd / | ||
+ | rm -f / | ||
+ | / | ||
+ | </ | ||
+ | * Umount all the image files and '' | ||
+ | umount / | ||
+ | umount / | ||
+ | umount / | ||
+ | umount / | ||
+ | gzip -9f / | ||
+ | mv / | ||
+ | </ | ||
+ | * And finally, clean up behind us: < | ||
+ | rm -r /tmp/pxe | ||
+ | </ | ||
+ | |||
+ | <note tip> I have written a script // | ||
+ | |||
+ | < | ||
+ | I have an accompanying [[http:// | ||
+ | |||
+ | ==== Creating a pxelinux configuration file ==== | ||
+ | |||
+ | Save the isolinux.cfg file from the Slackware CDROM to the tftp directory: < | ||
+ | mkdir -p / | ||
+ | cp / | ||
+ | </ | ||
+ | sed -i -e " | ||
+ | -e " | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Note: The [[http:// | ||
+ | |||
+ | ===== Trying it out ===== | ||
+ | |||
+ | You now have a fully configured PXE server. Try it out!\\ | ||
+ | Take a computer that is able to do a network boot, start it, and watch it go through the motions of contacting the PXE server, downloading the PXE boot code and presenting you with the familiar Slackware installation screen! From there on you're on familiar grounds: choose a kernel, and off you go. | ||
+ | |||
+ | If you're not familiar with NFS installations, | ||
+ | |||
+ | * After you log in as root and setup the partitions using fdisk or cfdisk, you must load a kernel module for your network card.\\ | ||
+ | |||
+ | * Select a "NFS installation" | ||
+ | |||
+ | ^ Your own IP Address (pick any unused) | 192.168.0.111| | ||
+ | ^ Your netmask | ||
+ | ^ The gateway | ||
+ | ^ NFS server address | ||
+ | ^ Slackware directory on the NFS server | / | ||
+ | |||
+ | * From this point onwards, the installation proceeds just as when the SOURCE would have been a CDROM. | ||
+ | |||
+ | Good luck! | ||
+ | |||
+ | ====== Example configuration scripts ====== | ||
+ | |||
+ | == First example dhcpd.conf == | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | # dhcpd.conf | ||
+ | # | ||
+ | # Configuration file for ISC dhcpd | ||
+ | # | ||
+ | |||
+ | # If this DHCP server is the official DHCP server for the local | ||
+ | # network, the authoritative directive should be uncommented. | ||
+ | authoritative; | ||
+ | ddns-update-style none; | ||
+ | |||
+ | # Allow bootp requests | ||
+ | allow bootp; | ||
+ | |||
+ | # Point to the TFTP server: | ||
+ | next-server 192.168.0.1; | ||
+ | |||
+ | # Default lease is 1 week (604800 sec.) | ||
+ | default-lease-time 604800; | ||
+ | # Max lease is 4 weeks (2419200 sec.) | ||
+ | max-lease-time 2419200; | ||
+ | |||
+ | subnet 192.168.0.0 netmask 255.255.255.0 { | ||
+ | option domain-name " | ||
+ | option broadcast-address 192.168.0.255; | ||
+ | option subnet-mask 255.255.255.0; | ||
+ | option domain-name-servers 192.168.0.1; | ||
+ | option routers 192.168.0.10; | ||
+ | range dynamic-bootp 192.168.0.50 192.168.0.100; | ||
+ | use-host-decl-names on; | ||
+ | if substring (option vendor-class-identifier, | ||
+ | filename "/ | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | == Second example dhcpd.conf == | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | # dhcpd.conf | ||
+ | # | ||
+ | # Configuration file for ISC dhcpd | ||
+ | # | ||
+ | |||
+ | # If this DHCP server is the official DHCP server for the local | ||
+ | # network, the authoritative directive should be uncommented. | ||
+ | authoritative; | ||
+ | ddns-update-style none; | ||
+ | |||
+ | # Ignore bootp requests: | ||
+ | ignore bootp; | ||
+ | |||
+ | # option definitions common to all configured networks... | ||
+ | option domain-name-servers 192.168.0.1; | ||
+ | |||
+ | subnet 192.168.0.0 netmask 255.255.255.0 { | ||
+ | option domain-name " | ||
+ | option broadcast-address 192.168.0.255; | ||
+ | option subnet-mask 255.255.255.0; | ||
+ | option routers 192.168.0.10; | ||
+ | # We reserve the range 192.168.0.1 to 192.168.0.49 for static IP addresses | ||
+ | pool { | ||
+ | # Known clients (i.e. configured with a ' | ||
+ | # that request an IP address via DHCP | ||
+ | range 192.168.0.50 192.168.0.100; | ||
+ | # Default lease is 1 week (604800 sec.) | ||
+ | default-lease-time 604800; | ||
+ | # Max lease is 4 weeks (2419200 sec.) | ||
+ | max-lease-time 2419200; | ||
+ | deny unknown clients; | ||
+ | } | ||
+ | pool { | ||
+ | # Guests | ||
+ | range 192.168.0.150 192.168.0.200; | ||
+ | # Default lease is 8 hours (28800 sec.) | ||
+ | default-lease-time 28800; | ||
+ | # Max lease is 24 hours (86400 sec.) | ||
+ | max-lease-time 86400; | ||
+ | deny known clients; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # Hosts which require special configuration options can be listed in | ||
+ | # host statements. If no address is specified, the address will be | ||
+ | # allocated dynamically (if possible), but the host-specific information | ||
+ | # will still come from the host declaration. | ||
+ | |||
+ | # Fixed IP addresses can also be specified for hosts. These addresses | ||
+ | # should not also be listed as being available for dynamic assignment. | ||
+ | # Hosts for which fixed IP addresses have been specified can boot using | ||
+ | # BOOTP or DHCP. Hosts for which no fixed address is specified can only | ||
+ | # be booted with DHCP, unless there is an address range on the subnet | ||
+ | # to which a BOOTP client is connected which has the dynamic-bootp flag | ||
+ | # set. | ||
+ | |||
+ | # === Group definitions ============================================= | ||
+ | # Define groups of computers that you want to give special attention. | ||
+ | |||
+ | group { | ||
+ | # Non-PXE machines | ||
+ | |||
+ | # Default lease is 1 week (604800 sec.) | ||
+ | default-lease-time 604800; | ||
+ | # Max lease is 2 weeks (1209600 sec.) | ||
+ | max-lease-time 1209600; | ||
+ | |||
+ | #host penguin { | ||
+ | # hardware ethernet xx: | ||
+ | # fixed-address 192.168.0.2; | ||
+ | #} | ||
+ | } | ||
+ | |||
+ | group { | ||
+ | # PXEboot | ||
+ | |||
+ | # Default lease is 1 day (86400 sec.) | ||
+ | default-lease-time 86400; | ||
+ | # Max lease is 2 days (172800 sec.) | ||
+ | max-lease-time 172800; | ||
+ | |||
+ | # Allow bootp requests for this group: | ||
+ | allow bootp; | ||
+ | |||
+ | # Point to the TFTP server (required parameter!): | ||
+ | next-server 192.168.0.1; | ||
+ | |||
+ | # If you want to log the boot process, you will need to configure | ||
+ | # your logserver to allow logging from remote hosts. | ||
+ | #option log-servers 192.168.0.1; | ||
+ | |||
+ | use-host-decl-names on; | ||
+ | |||
+ | if substring (option vendor-class-identifier, | ||
+ | filename "/ | ||
+ | } | ||
+ | else if substring (option vendor-class-identifier, | ||
+ | filename "/ | ||
+ | } | ||
+ | |||
+ | host t43 { | ||
+ | hardware ethernet yy: | ||
+ | fixed-address 192.168.0.3; | ||
+ | } | ||
+ | } # end of PXEboot group | ||
+ | </ | ||
+ | |||
+ | == RC script == | ||
+ | |||
+ | < | ||
+ | |||
+ | Don't forget to make the script executable: < | ||
+ | if [ -x / | ||
+ | # Start the DHCP server: | ||
+ | / | ||
+ | fi | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # / | ||
+ | # This shell script takes care of starting and stopping | ||
+ | # the ISC DHCPD service | ||
+ | # | ||
+ | |||
+ | # Put the command line options here that you want to pass to dhcpd: | ||
+ | DHCPD_OPTIONS=" | ||
+ | |||
+ | [ -x / | ||
+ | |||
+ | [ -f / | ||
+ | |||
+ | start() { | ||
+ | # Start daemons. | ||
+ | echo -n " | ||
+ | / | ||
+ | echo | ||
+ | } | ||
+ | stop() { | ||
+ | # Stop daemons. | ||
+ | echo -n " | ||
+ | killall -TERM dhcpd | ||
+ | echo | ||
+ | } | ||
+ | status() { | ||
+ | PIDS=$(pidof dhcpd) | ||
+ | if [ " | ||
+ | echo "dhcpd is not running!" | ||
+ | else | ||
+ | echo "dhcpd is running at pid(s) ${PIDS}." | ||
+ | fi | ||
+ | } | ||
+ | restart() { | ||
+ | stop | ||
+ | start | ||
+ | } | ||
+ | |||
+ | # See how we were called. | ||
+ | case " | ||
+ | start) | ||
+ | start | ||
+ | ;; | ||
+ | stop) | ||
+ | stop | ||
+ | ;; | ||
+ | restart) | ||
+ | stop | ||
+ | start | ||
+ | ;; | ||
+ | status) | ||
+ | status | ||
+ | ;; | ||
+ | *) | ||
+ | echo " | ||
+ | ;; | ||
+ | esac | ||
+ | |||
+ | exit 0 | ||
+ | </ |