This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
PXE
This page is about using Gentoo as a PXE server to boot just about any operating system or bootable tool. Please extend it with your own experience. The primary focus is to boot live images and the page can get renamed once we have a better name for it.
Bootloaders
The article about Diskless nodes contains plenty of useful information on how to setup a PXE environment.
GRUB2
For client configuration, see for example: Setup PXE boot with EFI Using Grub2 from openSUSE kiwi
PXELINUX
iPXE
TFTP servers
So far I have best experience with net-ftp/tftp-hpa.
root #
emerge --ask net-ftp/tftp-hpa
To run it temporarily, you can use the following command line.
root #
in.tftpd -L --secure /tftproot
Bootable images
Gentoo installation
See:
Fedora installation
The following script creates a TFTP directory tree, downloads kernel and initrd images from a Fedora mirror and configures a netbootable instance of GRUB.
~/bin/fedora-pxe-install
#!/bin/bash -xe # Mirror URL mirror="http://dl.fedoraproject.org/pub/fedora/linux/" # Releases [ $# -eq 0 ] && releases="22 21/Server 21-Alpha/Workstation 20/Fedora" || releases="$*" # Architecture: x86 | x86_64 | ... architectures="x86_64 i386" # TFTP directory path prefix=/tftproot test -n "$prefix" menuentry() { cat << EOF menuentry "Install Fedora $release $arch ($state)" { linux /boot/$kernel repo=$repo initrd /boot/$initrd } EOF } check() { state="$1" repo="$mirror$state/$release/$arch/os" curl --silent --fail --head "$repo/" >/dev/null } download() { test -e "$1" && { echo "Skipping: $1" >&2; return 0; } echo "Downloading: $1 from $2" >&2 curl --silent --fail --output "$1" "$2" } grub2-mknetdir --net-directory "$prefix" for release in $releases; do for arch in $architectures; do check releases || check development || check releases/test || { echo "# Check failed for $release $arch"; break; } kernel="fedora-$(echo "$release" | tr / -)-$arch-kernel" initrd="fedora-$(echo "$release" | tr / -)-$arch-initrd" pxerepo="$repo/images/pxeboot" download "$prefix/boot/$kernel" "$pxerepo/vmlinuz" || { echo "# Couldn't download kernel for $release $arch"; break; } download "$prefix/boot/$initrd" "$pxerepo/initrd.img" || { echo "# Couldn't download initrd for $release $arch"; break; } menuentry done done | tee "$prefix/boot/grub/grub.cfg"
Adjust it to your needs and then run it without parameters.
root #
fedora-pxe-install
Now you just need to configure TFTP and DHCP so that /tftproot
is available to the netbooted machine and it that it requests /boot/grub/i386-pc/core.0
via TFTP.
Ubuntu installation
To install Ubuntu to a device via PXE, simply download an Ubuntu netboot image for the appropriate architecture. Note that most of the files in the release and architecture-specific directory are unnecessary, you simply need netboot.tar.gz
(about 40MB).
Extract that file to an appropriate TFTP-served directory and configure your DHCP server with the filename
directive to point at pxelinux.0
for the machine or subnet in question.
Note that you will also need to give the host(s) internet access as the netboot images are configured to pull packages down from the internet.