Show Table of Contents
第 21 章 准备网络安装
使用安装服务器执行网络安装时,可让您在使用网络引导服务器的多个系统中安装 Red Hat Enterprise Linux。这样,所有配置为执行这个安装的系统都将使用由这台服务器提供的映像引导,并自动启动安装程序。
注意
Red Hat Satellite 能够自动化 PXE 服务器的设置。更多信息请参阅《Red Hat Satellite 用户指南》。
网络安装至少需要两个系统:
- 服务器 - 运行 DHCP服务器、TFTP 服务器从服务器提供引导文件,同时 HTTP、FTP 或者 NFS 服务器托管安装映射。理论上讲,每个服务器在不同物理系统中运行;这部分所述步骤假设使用单一系统运行所有服务器。
- 客户端 - 要安装 Red Hat Enterprise Linux 的系统。安装开始时,客户端会查询 DHCP 服务器,从 TFTP 服务器中获取引导文件,并从 HTTP、FTP 或者 NFS 服务器下载安装映象。
注意
客户端系统需要至少 2GB RAM 方可通过网络成功安装。
与其他安装方法不同,这个方法不需要在客户端(即妖执行安装的系统)插入物理引导介质即可开始安装。本章论述了准备网络安装所必须的步骤。
准备网络安装时必须执行以下步骤:
- 为网络引导配置 tftp 服务器中的文件,配置
DHCP,并在 PXE 服务器中启动tftp服务。详情请查看 。重要
除 tftp 服务器外,GRUB2 引导装载程序还支持从HTTP进行网络引导。但使用此协议获取引导文件(安装程序的内核及初始 ram )时速度会很慢,并可能有超时失败的风险。建议使用 tftp 服务器提供引导文件。这个警告仅适用于内核及初始 ram 磁盘(vmlinuz和initrd)。从HTTP服务器中获取的安装源没有此类风险。 - 引导客户端(要在其中安装 Red Hat Enterprise Linux 的系统)并开始安装。
注意
本章论述了在 Red Hat Enterprise Linux 7 系统中设置网络引导服务器的步骤。有关在更早的 Red Hat Enterprise Linux 版本中配置网络引导的详情请参考那个发行本的《安装指南》。
21.1. 配置网络引导
设置包含在安装中使用的软件包库的网络服务器后,下一步是配置 PXE 服务器本身。这个服务器将包含引导 Red Hat Enterprise Linux 并开始安装所需文件。另外,还必须配置
DHCP 服务器,并启用和启动所有必需的服务。
注意
网络引导配置步骤在不同的系统中有所不同,具体要看您要安装 Red Hat Enterprise Linux 的 AMD64/Intel 64 系统是使用 BIOS 还是 UEFI。参考硬件文档查看您的硬件所使用的系统,然后按照本章中正确的步骤操作。
单独提供使用 GRUB2 引导装载程序通过网络位置引导 IBM Power Systems 的步骤。详情请查看 第 21.1.3 节 “为使用 GRUB2 的 IBM Power Systems 配置网络引导”。
有关配置网络服务器以便使用无外设系统(即没有直接连接显示器、键盘和鼠标的系统)的详情请查看 第 22.4 节 “无外设系统注意事项”。
21.1.1. 为使用 BIOS 的 AMD64 和 Intel 64 客户端配置 PXE 服务器
以下步骤是用来引导使用 BIOS 的 AMD64 和 Intel 64 系统准备 PXE 服务器。有关使用 UEFI 的系统的详情请查看 第 21.1.2 节 “为使用 UEFI 的 AMD64 和 Intel 64 客户端配置 PXE 服务器”。
过程 21.1. 为使用 BIOS 的系统配置 PXE 服务器
- 安装 tftp 软件包。请作为
root运行以下命令完成此步骤:#yum install tftp-server - 在
/etc/xinet.d/tftp配置文件中,将disabled参数从yes改为no。这个配置文件中还有其他控制 tftp 服务器行为的选项。可用选项请查看xinetd.conf(5)手册页。 - 在防火墙中允许
tftp服务的进入连接:#firewall-cmd --add-service=tftp注意
服务器重启后方可启用上述命令访问。要持久使用上述命令,请添加--permanent选项。有关 Red Hat Enterprise Linux 中的防火墙配置详情,请查看《Red Hat Enterprise Linux 7 安全指南》。 /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; option architecture-type code 93 = unsigned integer 16; 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 architecture-type = 00:07 { filename "uefi/shim.efi"; } else { filename "pxelinux/pxelinux.0"; } } }- 现在需要完整安装 DVD 的 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 - 在
tftpboot中创建pxelinux目录,并将pxelinux.0复制到该目录中:#mkdir /var/lib/tftpboot/pxelinux#cp publicly_available_directory/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux - 在
pxelinux/目录中创建目录pxelinux.cfg/:#mkdir /var/lib/tftpboot/pxelinux/pxelinux.cfg在pxelinux.cfg/目录中添加名为default的配置文件。/var/lib/tftpboot/pxelinux/pxelinux.cfg/default中的示例配置文件类似如下:default vesamenu.c32 prompt 1 timeout 600 display boot.msg label linux menu label ^Install system menu default kernel vmlinuz append initrd=initrd.img ip=dhcp inst.repo=http://10.32.5.1/mnt/archive/RHEL-7/7.x/Server/x86_64/os/ label vesa menu label Install system with ^basic video driver kernel vmlinuz append initrd=initrd.img ip=dhcp inst.xdriver=vesa nomodeset inst.repo=http://10.32.5.1/mnt/archive/RHEL-7/7.x/Server/x86_64/os/ label rescue menu label ^Rescue installed system kernel vmlinuz append initrd=initrd.img rescue label local menu label Boot from ^local drive localboot 0xffff
重要
必须使用以上示例中的inst.repo=Anaconda 选项指定安装程序映象及安装源。没有这个选项安装程序就无法引导。有关 Anaconda 引导选项的详情请查看 第 20.1 节 “在引导菜单中配置安装系统”。 - 将引导映象复制到您的
tftp/root 目录中:#cp /path/to/x86_64/os/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/ - 最后,如果没有运行
xinetd和dhcp服务,则需要启动该服务;如果该服务已运行,则需重新载入tftp、xinetd和dhcp。如果这些服务之前没有运行,则需启动这些服务:#systemctl start xinetd.service dhcpd.service如果要永久启用这些服务以便每次系统重启后自动启动,则还需要执行以下命令:#systemctl enable xinetd.service dhcpd.service要重新载入已运行服务的配置,请使用systemctl reload命令。
完成此步骤后,就可以使用 PXE 服务器就开始进行网络安装。现在可以启动要安装 Red Hat Enterprise Linux 的系统,在提示您指定引导源时选择 PXE 引导,并启动网络安装。有关详情请查看 第 5.1.2 节 “使用 PXE 通过网络在 AMD64 和 Intel 64 系统中引导安装”。
21.1.2. 为使用 UEFI 的 AMD64 和 Intel 64 客户端配置 PXE 服务器
以下步骤是用来引导使用 UEFI 的 AMD64 和 Intel 64 系统准备 PXE 服务器。有关使用 BIOS 的系统的详情请查看 第 21.1.1 节 “为使用 BIOS 的 AMD64 和 Intel 64 客户端配置 PXE 服务器”。
过程 21.2. 为使用 UEFI 的系统配置 PXE 服务器
- 安装 tftp 软件包。请作为
root运行以下命令完成此步骤:#yum install tftp-server - 在
/etc/xinet.d/tftp配置文件中,将disabled参数从yes改为no。这个配置文件中还有其他控制 tftp 服务器行为的选项。可用选项请查看xinetd.conf(5)手册页。 - 在防火墙中允许
tftp服务的进入连接:#firewall-cmd --add-service=tftp注意
服务器重启后方可启用上述命令访问。要持久使用上述命令,请添加--permanent选项。有关 Red Hat Enterprise Linux 中的防火墙配置详情,请查看《Red Hat Enterprise Linux 7 安全指南》。 /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; option architecture-type code 93 = unsigned integer 16; 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 architecture-type = 00:07 { filename "uefi/shim.efi"; } else { filename "pxelinux/pxelinux.0"; } } }- 现在您需要 shim 软件包中的
shim.efi文件,以及 ISO 映像文件中 grub2-efi 软件包的grubx64.efi文件。要访问这些文件,请作为 root 运行以下命令:#mount -t iso9660 /path_to_image/name_of_image.iso /mount_point -o loop,ro#cp -pr /mount_point/Packages/shim-version-architecture.rpm /publicly_available_directory#cp -pr /mount_point/Packages/grub2-efi-version-architecture.rpm /publicly_available_directory#umount /mount_point提取软件包:#rpm2cpio shim-version-architecture.rpm | cpio -dimv#rpm2cpio grub2-efi-version-architecture.rpm | cpio -dimv - 在
tftpboot/目录中为 EFI 引导映像创建名为uefi/的目录,并从您的 boot 目录复制它们:#mkdir /var/lib/tftpboot/uefi#cp publicly_available_directory/boot/efi/EFI/redhat/shim.efi /var/lib/tftpboot/uefi/#cp publicly_available_directory/boot/efi/EFI/redhat/grubx64.efi /var/lib/tftpboot/uefi/ - 在
uefi/目录中添加名为grub.cfg的配置文件。/var/lib/tftpboot/uefi/grub.cfg配置文件示例类似如下:set timeout=60 menuentry 'RHEL 7' { linuxefi uefi/vmlinuz ip=dhcp inst.repo=http://10.32.5.1/mnt/archive/RHEL-7/7.1/Server/x86_64/os/ initrdefi uefi/initrd.img }重要
必须使用以上示例中的inst.repo=Anaconda 选项指定安装程序映象及安装源。没有这个选项安装程序就无法引导。有关 Anaconda 引导选项的详情请查看 第 20.1 节 “在引导菜单中配置安装系统”。 - 将引导映像复制到您的
uefi/目录下:#cp /path/to/x86_64/os/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/uefi/ - 最后,启动
tftp、xinetd和dhcp服务(如果这些服务之前未运行),或者重新载入其更新的配置(如果在此过程中这些服务已运行)。如果这些服务之前没有运行,则需启动这些服务:#systemctl start xinetd.service dhcpd.service如果要永久启用这些服务以便每次系统重启后自动启动,则还需要执行以下命令:#systemctl enable xinetd.service dhcpd.service要重新载入已运行服务的配置,请使用systemctl reload命令。
完成此步骤后,就可以使用 PXE 服务器就开始进行网络安装。现在可以启动要安装 Red Hat Enterprise Linux 的系统,在提示您指定引导源时选择 PXE 引导,并启动网络安装。有关详情请查看 第 5.1.2 节 “使用 PXE 通过网络在 AMD64 和 Intel 64 系统中引导安装”。
21.1.3. 为使用 GRUB2 的 IBM Power Systems 配置网络引导
过程 21.3. 为使用 GRUB2 的 IBM Power Systems 配置网络引导服务器
- 安装 tftp-server 软件包。方法为:作为
root运行以下命令:#yum install tftp-server - 在
/etc/xinet.d/tftp配置文件中,将disabled参数从yes改为no。这个配置文件中还有其他控制 tftp 服务器行为的选项。可用选项请查看xinetd.conf(5)手册页。 - 在防火墙中允许
tftp服务的进入连接:#firewall-cmd --add-service=tftp注意
服务器重启后方可启用上述命令访问。要持久使用上述命令,请添加--permanent选项。有关 Red Hat Enterprise Linux 中的防火墙配置详情,请查看《Red Hat Enterprise Linux 7 安全指南》。 - 在 tftp root 中创建 GRUB2 网络引导目录:
#grub2-mknetdir --net-directory=/var/lib/tftpbootNetboot directory for powerpc-ieee1275 created. Configure your DHCP server to point to /boot/grub2/powerpc-ieee1275/core.elf注:该命令的输出结果是告诉您在DHCP配置中需要将哪个文件配置为filename。这对以后的步骤很重要。 - 创建 GRUB2 配置文件:
/var/lib/tftpboot/boot/grub2/grub.cfg。grub.cfg句法如《Red Hat Enterprise Linux 7 系统管理员指南》所述。以下是配置文件示例:set default=0 set timeout=5 echo -e "\nWelcome to the Red Hat Enterprise Linux 7.1 installer!\n\n" menuentry 'Red Hat Enterprise Linux 7' { linux grub2-ppc64/vmlinuz ro ip=dhcp inst.repo=http://10.32.5.1/mnt/archive/RHEL-7/7.1/Server/ppc64/os/ initrd grub2-ppc64/initrd.img }重要
必须使用以上示例中的inst.repo=Anaconda 选项指定安装程序映象及安装源。没有这个选项安装程序就无法引导。有关 Anaconda 引导选项的详情请查看 第 20.1 节 “在引导菜单中配置安装系统”。 /etc/dhcp/dhcpd.conf中的示例配置如下:subnet 192.168.0.1 netmask 255.255.255.0 { allow bootp; option routers 192.168.0.5; group { #BOOTP POWER clients filename "boot/grub2/powerpc-ieee1275/core.elf"; host client1 { hardware ethernet 01:23:45:67:89:ab; fixed-address 192.168.0.112; } } }调整示例中的参数(subnet,netmask,routers,fixed-addressandhardware ethernet)以符合您的网络配置。另外还请注意filename参数,这是之前使用grub2-mknetdir命令得到的结果。- 最后,启动
tftp、xinetd和dhcp服务(如果这些服务之前未运行),或者重新载入其更新的配置(如果在此过程中这些服务已运行)。如果这些服务之前没有运行,则需启动这些服务:#systemctl start xinetd.service dhcpd.service如果要永久启用这些服务以便每次系统重启后自动启动,则还需要执行以下命令:#systemctl enable xinetd.service dhcpd.service要重新载入已运行服务的配置,请使用systemctl reload命令。
完成这个步骤后,PXE 服务器就可以开始网络安装。现在可以依据 第 10 章 在 IBM Power Systems 中引导安装 所述步骤使用这个服务器引导您的 第 10 章 在 IBM Power Systems 中引导安装 客户端。
有关为 IBM Power Systems 客户端设置网络引导的附加信息,请查看 IBM Developerorks 网页《POWER 网络引导 - 简介》。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.