Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


pxe_uefi

CentOS 7 - UEFI PXE server

Installs a UEFI PXE server with Arch Linux installer and UEFI shell boot options.

  • Install prerequisites:
    yum install tftp-server dhcp xinetd grub2-efi grub2-efi-modules
  • Configure DHCPd /etc/dhcp/dhcpd.conf
    subnet 10.10.10.0 netmask 255.255.255.0 {
      range 10.10.10.200 10.10.10.250;
      option domain-name "<domain>";
      option domain-name-servers <nameserver1>, <nameserver2>;
      option ntp-servers <ntp1>, <ntp2>;
      option routers 10.10.10.1;
      next-server <this_pxeserver>;
      filename "/boot/grub/x86_64-efi/core.efi";
    
      default-lease-time 600;
      max-lease-time 7200;
    }
  • Enable and start DHCPd:
    systemctl enable dhcpd
    systemctl start dhcpd
  • Configure the firewall:
    firewall-cmd --zone public --add-service=dhcp --permanent
    firewall-cmd --zone public --add-service=tftp --permanent
    firewall-cmd --zone public --add-service=http --permanent
    firewall-cmd --reload
  • Configure xinetd /etc/xinetd.d/tftp
    	disable			= no
  • Enable and start xinetd:
    systemctl enable xinetd
    systemctl start xinetd
  • Create grub configuration, this is een Arch linux install example:
    mkdir -p /var/lib/tftpboot/boot/grub/
    vi /var/lib/tftpboot/boot/grub/grub.cfg
    set timeout=5
    
    menuentry 'archlinux-2017.07.01-x86_64' --class os {
         insmod all_video
    
         echo 'Network config:'
         net_ls_cards
         net_ls_addr
         net_ls_routes
    
         set root=http,<this_pxeserver>
         
         echo 'Loading Linux...'
         linuxefi /arch/boot/x86_64/vmlinuz archisobasedir=arch archiso_http_srv=http://<this_pxeserver>/ archisobasedir=arch ip=:::::eth0:dhcp
    
         echo 'Loading Intel micro code, initrd...'
         initrdefi /arch/boot/intel_ucode.img /arch/boot/x86_64/archiso.img
    }
    
    menuentry 'UEFI Shell' {
      chainloader ($root)/boot/uefishell/Shell.efi
    }
    
  • Create network bootable grub:
    grub2-mknetdir --net-directory=/var/lib/tftpboot --subdir=/boot/grub -d /usr/lib/grub/x86_64-efi/
  • Add Arch ISO:
    curl -O http://ftp.nluug.nl/os/Linux/distr/archlinux/iso/2017.07.01/archlinux-2017.07.01-x86_64.iso
    mount archlinux-2017.07.01-x86_64.iso /mnt
    cp -R /mnt/* /var/www/html
  • Add UEFI Shell:
    mkdir -p /var/lib/tftpboot/boot/uefishell
    curl -OL https://github.com/tianocore/edk2/raw/master/ShellBinPkg/UefiShell/X64/Shell.efi
pxe_uefi.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1