Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

30.2. 网络引导配置

下一步是将启动安装所必需的文件复制到 tftp 服务器中,这样当客户端需要它们时就可以找到。tftp 服务器和导出安装树的网络服务器通常是同一个。
PXE 引导配置步骤与 BIOS 和 EFI 不同。为 Power  系统服务器提供独立的 yaboot 配置步骤。

注意

Red Hat Satellite has the ability to automate the setup of a PXE server. See the Red Hat Satellite User Guide for more information.

30.2.1. 为 BIOS 配置 PXE 引导

  1. 如果还没有安装 tftp-server,请运行 yum install tftp-server
  2. In the tftp-server config file at /etc/xinetd.d/tftp, change the disabled parameter from yes to no.
  3. Configure your DHCP server to use the boot images packaged with SYSLINUX. (If you do not have a DHCP server installed, refer to the DHCP Servers chapter in the Red Hat Enterprise Linux Deployment Guide.)
    /etc/dhcp/dhcpd.conf 中的示例配置如下:
      option space pxelinux;
      option pxelinux.magic code 208 = string;
      option pxelinux.configfile code 209 = text;
      option pxelinux.pathprefix code 210 = text;
      option pxelinux.reboottime code 211 = unsigned integer 32;
    
      subnet 10.0.0.0 netmask 255.255.255.0 {
              option routers 10.0.0.254;
              range 10.0.0.2 10.0.0.253;
    
              class "pxeclients" {
                      match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
                      next-server 10.0.0.1;
    
                      if option arch = 00:06 {
                              filename "pxelinux/bootia32.efi";
                      } else if option arch = 00:07 {
                              filename "pxelinux/bootx64.efi";
                      } else {
                              filename "pxelinux/pxelinux.0";
                      }
              }
    
              host example-ia32 {
                      hardware ethernet XX:YY:ZZ:11:22:33;
                      fixed-address 10.0.0.2;
              }
      }
    
  4. 现在需要 ISO 映像文件中 SYSLINUX 软件包中的 pxelinux.0 文件。要访问该文件,请作为 root 运行以下命令:
    mount -t iso9660 /path_to_image/name_of_image.iso /mount_point -o loop,ro
    cp -pr /mount_point/Packages/syslinux-version-architecture.rpm /publicly_available_directory
    umount /mount_point
    提取软件包:
    rpm2cpio syslinux-version-architecture.rpm | cpio -dimv
  5. tftpboot 中创建 pxelinux 目录,并将 pxelinux.0 复制到该目录中:
    mkdir /var/lib/tftpboot/pxelinux
    cp publicly_available_directory/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux
  6. pxelinux 中创建 pxelinux.cfg 目录:
    mkdir /var/lib/tftpboot/pxelinux/pxelinux.cfg
  7. Add a config file to this directory. The file should either be named default or named after the IP address, converted into hexadecimal format without delimiters. For example, if your machine's IP address is 10.0.0.1, the filename would be 0A000001.
    /var/lib/tftpboot/pxelinux/pxelinux.cfg/default 中的示例配置未见类似如下:
    default vesamenu.c32
    prompt 1
    timeout 600
    
    display boot.msg
    
    label linux
      menu label ^Install or upgrade an existing system
      menu default
      kernel vmlinuz
      append initrd=initrd.img
    label vesa
      menu label Install system with ^basic video driver
      kernel vmlinuz
      append initrd=initrd.img xdriver=vesa nomodeset
    label rescue
      menu label ^Rescue installed system
      kernel vmlinuz
      append initrd=initrd.img rescue
    label local
      menu label Boot from ^local drive
      localboot 0xffff
    label memtest86
      menu label ^Memory test
      kernel memtest
      append -
    关于如何指定安装源的步骤,请参考 第 7.1.3 节 “其他引导选项”
  8. 将 splash 映像复制到 tftp 根目录下:
    cp /boot/grub/splash.xpm.gz /var/lib/tftpboot/pxelinux/splash.xpm.gz
  9. 将引导映像复制到 tftp 根目录下:
    cp /path/to/x86_64/os/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/rhel6/
  10. Boot the client system, and select the network device as your boot device when prompted.