Documentation for a newer release is available. View Latest

Configurar un Servidor de Instalación

Este apéndice está dirigido a los usuarios con experiencia previa en Linux. Si es un usuario nuevo debería instalar usando un medio de arranque mínimo o el DVD de la distribución en su lugar.

Visión General de la Instalación PXE

Preboot Execution Environment, o PXE, es una tecnología que permite a los ordenadores arrancar directamente desde recursos proporcionados por una red. Instalar Fedora sobre la red significa que no tiene que crear un medio y puede instalar múltiples ordenadores o máquinas virtuales simultáneamente. El proceso involucra a diversos componente y funciones trabajando juntos para proporcionar los recursos que se requieren.

Ordenador capaz PXE

Los ordenadores más modernos tienen la capacidad de arrancar desde la red. Normalmente, una tecla de función pulsada durante el arranque traerá un menú de selección de arranque. En entornos diseñados para administración sin atención, los sistemas estarán con frecuencia configurados para, como primer intento, arrancar desde la red, después desde el almacenamiento local y el servidor de instalación está configurado para ofrecer solo la instalación cuando se le pida. El manual de su ordenador proporcionará instrucciones específicas sobre la configuración de las prioridades de arranque.

Servidor DHCP

Cuando un sistema solicita una dirección durante un arranque en red, el servidor DHCP proporciona también la localización de los archivos de arranque. Una red solo un servidor DHCP.

Servidor TFTP

Como el entorno previo al arranque es muy sencillo, los ficheros se deben proporcionar de un modo muy sencillo. Trivial File Transfer Protocol, o TFTP, proporciona al sistema el cargador de arranque necesario para continuar el proceso de instalación.

Cargador de arranque

Como el trabajo de arranque de un sistema operativo es demasiado complejo para el entorno previo al arranque, se utiliza un cargador de arranque para cargar el kernel y los archivos relacionados. También proporciona información de configuración al instalador y puede ofrecer un menú para la selección de distintas configuraciones.

Kernel e Initramfs

El kernel es el núcleo de cualquier sistema operativo Linux e initramfs proporciona al kernel las herramientas y recursos que necesita. Estos archivos son proporcionados también por tftp.

Repositorios de paquetes

Debe haber disponible un repositorio de Fedora para la instalación. El ejemplo en esta sección usa los espejos públicos de Fedora como repositorio fuente, pero usted puede usar un repositorio en la red local proporcionado por NFS, FTP o HTTP. Los repositorios se pueden configurar usando la opción de arranque [option]#inst.repo=#n; vea detalles en Specifying the Installation Source.

Configuración del Servidor DHCP

Instalar y configurar dhcpd
  1. Instalar el paquete servidor dhcp.

    # dnf install dhcp-server
  2. Create a simple configuration for the dhcp server at /etc/dhcp/dhcpd.conf

    subnet 192.168.1.0 netmask 255.255.255.0 {
    authoritative;
    default-lease-time 600;
    max-lease-time 7200;
    ddns-update-style none;
    
    option domain-name-servers 192.168.1.1;
    option routers 192.168.1.1;
    
    }
  3. Test your configuration and address any problems you discover.

    systemctl start dhcpd
    systemctl enable dhcpd
    journalctl --unit dhcpd --since -2m --follow
  4. Add entries to point clients to their bootloader and the server that provides it to your subnet configuration in /etc/dhcp/dhcpd.conf. Because DHCP clients provide the server with identifying information along with their address request, BIOS clients and UEFI clients can each be directed to the correct bootloader. Using latest processor architecture option codes, which may be found on the IANA DHCPv6 registration page, allows multiple architectures to share a single DHCP server.

    # refer to RFC4578 & IANA DHCPv6 for possible arch option values
    option arch code 93 = unsigned integer 16;
    
    subnet 192.168.1.0 netmask 255.255.255.0 {
    if option arch = 00:07 {
    # x64 UEFI
    filename "uefi/shimx64.efi";
    next-server 192.168.1.2;
    } else if option arch = 00:0b {
    # aarch64 UEFI
    filename "uefi/shimaa64.efi";
    server-name "192.168.1.2";
    } else {
    filename "pxelinux.0";
    next-server 192.168.1.2;
    }
    
    
    ...
  5. Restart the dhcp service to check the configuration and make changes as needed.

    systemctl restart dhcpd
    journalctl --unit dhcpd --since -2m --follow

Installing the tftp server

Installing the tftp server
  1. Install the tftp server package.

    # dnf install tftp-server
  2. Start and enable the tftp socket. systemd will automatically start the tftpd service when required.

    # systemctl start tftp.socket
    # systemctl enable tftp.socket

Providing and configuring bootloaders for PXE clients

Getting the bootloader files
  1. Get the syslinux bootloader for BIOS clients.

    1. Install the syslinux package.

      # dnf install syslinux
    2. Create a directory for the bootloader files, and make them available there.

      # mkdir -p /var/lib/tftpboot/pxelinux.cfg
      # cp /usr/share/syslinux/{pxelinux.0,menu.c32,vesamenu.c32,ldlinux.c32,libcom32.c32,libutil.c32} /var/lib/tftpboot/
  2. Get the bootloader files for UEFI systems

    1. Install the shim-x64 and grub2-efi-x64 packages. If your server is a BIOS system, you must install the packages to a temporary install root. Installing them directly on a BIOS machine will attempt to configure the system for UEFI booting and cause problems.

      # dnf install shim-x64 grub2-efi-x64 --installroot=/tmp/fedora --releasever 35
    2. Create a directory for the bootloader files, and make them available there.

      # mkdir -p /var/lib/tftpboot/uefi
      # cp /tmp/fedora/boot/efi/EFI/fedora/{shimx64.efi,grubx64.efi} /var/lib/tftpboot/uefi/
Configuring client bootloaders
  1. Create a boot menu for BIOS clients at /var/lib/tftpboot/pxelinux.cfg/default.

    default vesamenu.c32
    prompt 1
    timeout 600
    
    label local
    menu label Boot from ^local drive
    menu default
    localboot 0xffff
    
    label linux
    menu label ^Install Fedora 35 64-bit
    kernel f35/vmlinuz
    append initrd=f35/initrd.img inst.stage2=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/os/ ip=dhcp
    
    label server
    menu label ^Install Fedora 35 ( Minimal Image )
    kernel f35/vmlinuz
    append initrd=f35/initrd.img inst.stage2=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/os/ ip=dhcp ks=https://example.com/fedora/kickstarts/minimal.ks
  2. Create a boot menu for UEFI clients at /var/lib/tftpboot/uefi/grub.cfg.

    function load_video {
    	insmod efi_gop
    	insmod efi_uga
    	insmod video_bochs
    	insmod video_cirrus
    	insmod all_video
    }
    
    load_video
    set gfxpayload=keep
    insmod gzio
    
    menuentry 'Exit this grub' {
            exit
    }
    
    menuentry 'Install Fedora 64-bit'  --class fedora --class gnu-linux --class gnu --class os {
    	linux $fw_path/f35/vmlinuz ip=dhcp inst.repo=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/os/
    	initrd $fw_path/f35/initrd.img
    }
    
    menuentry 'Install Fedora 35 Server'  --class fedora --class gnu-linux --class gnu --class os {
    	kernel f35/vmlinuz
    	append initrd=f35/initrd.img inst.repo=https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/os/ ip=dhcp ks=https://git.fedorahosted.org/cgit/spin-kickstarts.git/plain/fedora-install-server.ks?h=f21
    }

Getting the kernel and initrd

Downloading the kernel and initrd
  1. Create a directory for the files.

    # mkdir -p /var/lib/tftpboot/f35
  2. Download the kernel.

    # wget https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/os/images/pxeboot/vmlinuz -O /var/lib/tftpboot/f35/vmlinuz
  3. Download the initrd

    # wget https://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/os/images/pxeboot/initrd.img -O /var/lib/tftpboot/f35/initrd.img

HTTP Installation Overview

HTTP/HTTPS boot is a technology that allows computers to boot directly from resources provided over the network. When used in conjunction with HTTPS the authenticity of the server is validated, and the use of HTTP offers a more reliable transport mechanism than PXE’s TFTP. Installing Fedora this way avoids creating install media and allows multiple computers to install simultaneously. Many current UEFI implementations, including the EDK2 based firmware shipping with fedora’s virtualization solutions, can directly boot from HTTP sources. A UEFI boot entry may be manually added that specifies a HTTP source via firmware menus. Alternatively, a DHCP server may automatically provide the required HTTP path.

Enrolling Certificatesll

While many machines are capable of HTTPS boot as well as HTTP, they will frequently need to have a certificate authority (CA) enrolled first. The CA is used to validate the certificates presented by the HTTPS server. This may be accomplished by enrolling the appropriate files from the fedora provided ca-certificates for public mirrors or the local HTTPS boot server’s certificate.

DHCP Server Configuration for HTTP

The installation and configuration of a DHCP server for HTTP boot is identical to its configuration for PXE except that we need to amend the option arch conditions for HTTP clients

....

if option arch = 00:07 {
# x64 UEFI
filename "uefi/shim64.efi";
next-server 192.168.1.2;
} else if option arch = 00:0b {
# aarch64 UEFI
filename "uefi/shimaa64.efi";
server-name "192.168.1.2";
} else if option arch = 00:13 {
# aarch64 UEFI HTTP
option vendor-class-identifier "HTTPClient";
filename "http://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/aarch64/os/images/boot.iso";
} else if option arch = 00:10 {
# x64 UEFI HTTP
option vendor-class-identifier "HTTPClient";
filename "http://download.fedoraproject.org/pub/fedora/linux/releases/35/Server/x86_64/os/images/boot.iso";
} else {
filename "pxelinux.0";
next-server 192.168.1.2;
}

...

Providing repositories

The examples in this section use the public Fedora mirrors as the package source. For faster installations, installing to many systems, or more isolated environments, you may wish to maintain a local repository.

Fedora Infrastructure maintains instructions for configuring a local mirror at https://fedoraproject.org/wiki/Infrastructure/Mirroring. The preferred method for providing repositories is via HTTP, and you can refer to the Fedora System Administrator’s Guide to configure httpd.

Advanced network installations with Cobbler

For more complex environments, Fedora offers the cobbler installation server. Tasks like managing kickstart configurations, coordinating repositories, maintaining dns records, dhcp servers, and even puppet manifests are effectively automated by cobbler.

While levaraging all of the features provided by cobbler can be relatively simple, the full functionality of this powerful tool is too broad to be documented in this guide. The cobbler community provides documentation at https://cobbler.github.io/ to accompany the packages in the Fedora repository.

Alternatively, you may also be interested in Foreman. You can find official documentation as well as downloads on the project website at https://www.theforeman.org/.