Operating System: Red Hat Enterprise Linux Server 7.3 (Maipo)
IPADDR:10.10.0.123
==================
==================
传统Legacy BIOS和EFI BIOS引导区别:
对于传统Legacy BIOS,一般使用syslinux提供的pxelinux.0来引导。对于EFI BIOS,需要使用efi文件引导,一般可使用Grub2。为实现UEFI SecureBoot,大多数Linux使用shim.efi嵌套调用grub.efi来引导。
grubx64.efi和shimx64.efi有什么区别呢?在安全启动(serureboot)关闭的情况下,你可以使用grubx64.efi。如果安全启动打开则需要选择shimx64.efi。
传统Legacy BIOS引导,在pxelinux.0引导后,它会请求并加载server端tftpboot目录中,与pxelinux.0同目录下的pxelinux.cfg目录里的default文件。
Apr 17 21:21:48 localhost in.tftpd[23465]: Client ::ffff:10.10.0.133 finished pxelinux.0
Apr 17 21:21:48 localhost in.tftpd[23476]: Client ::ffff:10.10.0.133 finished pxelinux.cfg/default
Apr 17 21:21:48 localhost in.tftpd[23477]: Client ::ffff:10.10.0.133 finished boot.msg
Apr 17 21:21:48 localhost in.tftpd[23479]: Client ::ffff:10.10.0.133 finished vesamenu.c32
Apr 17 21:21:48 localhost in.tftpd[23480]: Client ::ffff:10.10.0.133 finished pxelinux.cfg/default
Apr 17 21:21:48 localhost in.tftpd[23481]: Client ::ffff:10.10.0.133 finished splash.png
Apr 17 21:21:59 localhost in.tftpd[23482]: Client ::ffff:10.10.0.133 finished vmlinuz
Apr 17 21:22:04 localhost in.tftpd[23483]: Client ::ffff:10.10.0.133 finished initrd.im
EFI BIOS引导,在shim.efi嵌套引导了grubx64.efi之后,它会请求grubx64.efi同目录下的grub.cfg配置文件(redhat7),同时加载显示引导菜单。而对于RHEL6来说,它并不支持SecureBoot,所以必须要使用grub-efi 0.97来引导,一般是BOOTX64.efi,同时它会请求同目录下的efidefault配置文件(redhat6),加载并显示引导菜单。
RHEL6对EFI支持并不好,所以RHEL6推荐使用Legacy而不是EFI模式来安装。
--------以下日志为redhat 7.3 uefi 引导日志。
Apr 17 21:16:03 localhost in.tftpd[22088]: Client ::ffff:10.10.0.131 finished uefi/shim.efi
Apr 17 21:16:03 localhost in.tftpd[22089]: Client ::ffff:10.10.0.131 finished uefi/grubx64.efi
Apr 17 21:16:03 localhost in.tftpd[22099]: Client ::ffff:10.10.0.131 finished /uefi/grub.cfg
Apr 17 21:16:03 localhost in.tftpd[22100]: Client ::ffff:10.10.0.131 finished /uefi/grub.cfg
Apr 17 21:16:03 localhost in.tftpd[22105]: Client ::ffff:10.10.0.131 finished /uefi/grub.cfg
Apr 17 21:16:03 localhost in.tftpd[22106]: Client ::ffff:10.10.0.131 finished /uefi/grub.cfg
Apr 17 21:16:03 localhost in.tftpd[22107]: Client ::ffff:10.10.0.131 finished /uefi/grub.cfg
Apr 17 21:16:09 localhost in.tftpd[22108]: Client ::ffff:10.10.0.131 finished images/vmlinuz
Apr 17 21:16:11 localhost in.tftpd[22109]: Client ::ffff:10.10.0.131 finished images/vmlinuz
Apr 17 21:16:16 localhost in.tftpd[22110]: Client ::ffff:10.10.0.131 finished images/initrd.img
=================
1.软件安装
yum -y install vsftpd dhcp xinetd* tftp-server
=================
2.准备文件:
BOOTX64.EFI grub.cfg grubx64.efi initrd.img shim.efi vmlinuz
=================
从RHEL7光盘中提取shim.efi和grubx64.efi:
cp /mnt/Packages/shim-0.9-2.el7.x86_64.rpm /tmp
cp /mnt/Packages/grub2-efi-2.02-0.44.el7.x86_64.rpm /tmp
rpm2cpio /tmp/shim-0.9-2.el7.x86_64.rpm | cpio -dimv
rpm2cpio /tmp/grub2-efi-2.02-0.44.el7.x86_64.rpm| cpio -dimv
mkdir -p /var/lib/tftpboot/uefi/
cp /tmp/boot/efi/EFI/redhat/shim.efi/var/lib/tftpboot/uefi/
cp /tmp/boot/efi/EFI/redhat/grubx64.efi /var/lib/tftpboot/uefi/
从RHEL7光盘拷贝内核文件:
cp /mnt/EFI/BOOT/BOOTX64.EFI /var/lib/tftpboot/uefi/
cp /mnt/isolinux/vmlinuz /var/lib/tftpboot/uefi/
cp /mnt/isolinux/initrd.img /var/lib/tftpboot/uefi/
//grubx64.efi和shimx64.efi有什么区别呢?在安全启动(serureboot)关闭的情况下,你可以使用grubx64.efi。如果安全启动打开则需要选择shimx64.efi。
grub.cfg文件配置:
cat >> /var/lib/tftpboot/uefi/grub.cfg <
set timeout=5
menuentry 'Install RHEL 7.3 via [UEFI] PXE+Kickstart' {
linuxefi uefi/vmlinuz inst.repo=ftp://10.10.0.123/pub inst.ks=ftp://10.10.0.123/ks.cfg
initrdefi uefi/initrd.img
}
eof
=================
3.DHCP配置
=================
修改配置设定提供DHCP的网卡/etc/sysconfig/dhcpd: (可选)
DHCPDARGS=ens33 //根据实际需求更改!
cat>> /etc/dhcp/dhcpd.conf<
option architecture-type code 93 = unsigned integer 16;
subnet 10.10.0.0 netmask 255.255.255.0 {
range 10.10.0.124 10.10.0.254;
option routers 10.10.0.1;
class "pxeclients" {
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 10.10.0.123;
if option architecture-type = 00:07 or
option architecture-type = 00:09 {
filename "uefi/shim.efi";
} else {
filename "pxelinux.0"; # tftp 目录下pxelinux的文件名
}
}
}
eof
//RHEL7以支持UEFI SecureBoot。通过TFTP把shim.efi加载后会继续嵌套加载引导同目录下的grubx64.efi,然后grub会获取同目录下的grub.cfg以显示引导菜单。
//对于EFI模式下RHEL6 PXE引导,需要dhcpd.conf指定filename "images/BOOTX64.efi",它其实是grub 0.97。通过TFTP加载了BOOTX64.efi之后它会继续加载同目录下的efidefault引导配置文件,并显示引导菜单。
=================
4,ks.cfg文件配置
kickstart文件说明参见:https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-kickstart-syntax.html
=================
UEFI操作系统安装分区注意事项:
part /boot/efi --fstype=efi --size=200#UEFI引导安装时需要,传统LEGACY引导时可屏蔽此选项
part /boot --fstype="ext4" --size=500 --ondisk=sda
part pv.01 --grow --size=20000 --ondisk=sda
volgroup rootvg pv.01
logvol / --fstype="ext4" --size=10240 --name=root --vgname=rootvg
logvol swap --fstype="swap" --size=1024 --name=swap --vgname=rootvg
//安装完成系统,默认分区磁盘类型为GPT。
参考:
http://hmli.ustc.edu.cn/doc/linux/centos-autoinstall.htm
http://blog.sina.com.cn/s/blog_5f2e119b0102x6dd.html
网站题目:使用PXEEFI引导安装RHEL7.3
文章转载:
http://shouzuofang.com/article/jsdojp.html