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 revision | |||
— | slackware:pxe [2009/05/19 14:22] (current) – Update the tutorial for Slackware 12.2 (way way easier)... 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 you install 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 else you fetch the packages from a [[slackware: | ||
+ | |||
+ | The number of available 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 using a USB stick.\\ There is even loadlin, the DOS based Linux starter, but lets not concern ourselves with the past today. Slackware 12.0 abandoned the floppy boot altogether. | ||
+ | |||
+ | But what if your PC is lacking 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 another way of booting your computer that the Slackware installer supports. That is the //network boot//. Network boot, or "PXE boot", requires support from your computer' | ||
+ | |||
+ | In this README, I will show you how to perform an 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. | ||
+ | |||
+ | I will describe how to setup a server with the proper software, and how to use some of the files on the Slackware CDROM so that PXE-boot becomes a supported installation method for Slackware Linux. Alternatively, | ||
+ | |||
+ | |||
+ | ===== 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 roughly be 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 its 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 network server that holds the Slackware package tree. Currently, NFS, FTP or HTTP installs are supported means of getting to your network data. The Slackware installer will use udev to configure your network card. If your network card is not supported by any of the available drivers, you're out of luck and will have to re-evaluate your options. | ||
+ | * From here on, installation proceeds as usual, under the condition that you select //Install from NFS (Network File System)// or //Install from FTP/HTTP 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 its desire to find a suitable server to download the bootstrap code from. The ISC DHCP Server which comes as 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, FTP or HTTP server is required because we must perform a network install. 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: | ||
+ | * Top level of the complete Slackware 12.2 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 its 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 ===== | ||
+ | |||
+ | The previous paragraph described in generic terms how to setup the TFTP service, but it did not tell you how to populate the TFTP directory structure so that network clients can request and obtain boot files. | ||
+ | |||
+ | PXELinux is much like isolinux, which is the bootloader that is used for the bootable Slackware CDROM #1. In fact, both programs are written by the same author and are available in Slackware via the syslinux package. | ||
+ | |||
+ | |||
+ | ==== The tftp directory structure ==== | ||
+ | |||
+ | The usual way of installing Slackware from a NFS server repository, is to boot the Slackware CDROM, and let udev load the driver for your network card before starting '' | ||
+ | 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 have all the drivers we need inside the root filesystem which the PXElinux bootloader downloads from the TFTP server. This root filesystem is wrapped in the '' | ||
+ | |||
+ | As you can see in the [[# | ||
+ | This filename ''/ | ||
+ | mkdir / | ||
+ | mkdir / | ||
+ | cp / | ||
+ | </ | ||
+ | cp / | ||
+ | cp / | ||
+ | cp / | ||
+ | </ | ||
+ | cp -a / | ||
+ | </ | ||
+ | cp / | ||
+ | cp / | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== 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. | ||
+ | |||
+ | * 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. | ||
+ | |||
+ | * If you have configured a FTP or HTTP server with a Slackware package tree instead, the dialogs are similar. | ||
+ | |||
+ | 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 | ||
+ | </ |