JavaScript must be enabled in order for you to see "WP Copy Data Protect" effect. However, it seems JavaScript is either disabled or not supported by your browser. To see full result of "WP Copy Data Protector", enable JavaScript by changing your browser options, then try again.

架設RHEL 7.0/SLES 12 RC1的UEFI PXE Server on RHEL 7.0 x64


最近在Survey新的OS架設UEFI PXE Server,整體感覺與RHEL6的方式大同小異,不過因為要測試PXE Function under UEFI Mode,還是記錄一下如何架設,此外,新的OS都採用Grub2-EFI的Bootloader,所以Config的設定有些許不同,總之,直接看下去就知道蹊蹺了,對了,這邊只介紹X86架構的部分,至於IA32就不在這邊說明了(感謝B大幫我再Review一次找出Bugs):

I.RHEL7 OS Bacic Setting

1) 在裝完RHEL 7.0後,補上其餘所需的套件(安裝時就算全選,有些套件還是會漏掉,除非是用Kickstart的方式做補齊動作)
#mount -o loop rhel-server-7.0-x86_64-dvd.iso /mnt
#cd /mnt/Packages/
#rpm -qa | grep -i syslinux -> Query the following packages are be installed
#rpm -qa | grep -i nfs
#rpm -qa | grep -i http
#rpm -qa | grep -i vsftp
#rpm -ivh xinetd-2.3.15-12.el7.x86_64.rpm
#rpm -ivh tftp-5.2-11.el7.x86_64.rpm
#rpm -ivh tftp-server-5.2-11.el7.x86_64.rpm
#rpm -ivh dhcpd-4.2.5-27.el7.x86_64.rpm

2) 一些其餘的Setup與Network Basic Settings
#tzselect -> Asia/Taipei(Modify Timezone)
#date MMDDHHMMYYYY
#hwclock -w -> Sync with system and hardware time
#service firewalld stop
#chkconfig firewalld off
#service NetworkManager stop
#chkconfig NetworkManager off
#vi /etc/sysconfig/selinux -> Modify with the value of 'Disable'
#vi /etc/hostname -> Modify the Hostname you want(EX:uefi.pxe.com)
#ls -al /sys/class/net -> Query the NIC's Name(Because of CDNN)
#vi /etc/sysconfig/network-scripts/ifcfg-ens4f0 -> Modify with the Static IP(EX:192.168.1.10/24)
#vi /etc/hosts -> Add the domain name about the PXE Server
#service network restart

II.Copy the requirement files from the image

3) 建出Image的目錄以及複製Image的所有file(TFTP內放置Kernel和Initrd的檔案)
#mkdir -p /var/ftp/as7-64/
#cp -rf /mnt/* /var/ftp/as7-64/
#mkdir -p /var/ftp/tftpboot/as7-64/
#cp -rf /var/ftp/as7-64/images/pxeboot/initrd.img /var/ftp/as7-64/
#cp -rf /var/ftp/as7-64/images/pxeboot/vmlinuz /var/ftp/as7-64/
#cp -rf /var/ftp/as7-64/EFI/BOOT/BOOTX64.efi /var/lib/tftpboot/ -> Same as shim.efi from #rpm2cpio shim-signed-0.7-5.2.el7 x86_64 rpm | cpio -dimv
#cp -rf /var/ftp/as7-64/EFI/BOOT/grubx64.efi /var/lib/tftpboot/
#cp -rf /var/ftp/as7-64/EFI/BOOT/grub.cfg /var/lib/tftpboot/
#vi /var/lib/tftpboot/grub.cfg
set default="0"
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
insmod part_gpt
insmod ext2
set timeout=60
### END /etc/grub.d/00_header ###
search --no-floppy --set=root -l 'RHEL-7.0 Server.x86_64'
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Install RHEL 7.0 x64 (UEFI)' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /as7-64/vmlinuz lang=en_US keymap=us method=nfs:192.168.1.10:/var/ftp/as7-64/ ip=dhcp
initrdefi /as7-64/initrd.img
}
menuentry 'Install SLES 12 RC1 x64 (UEFI)' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /sles12-64/linux lang=en_US keymap=us ip=dhcp
initrdefi /sles12-64/initrd
}
}
#umount /mnt
#mount -o loop SLE-12-Server-DVD-x86_64-RC1-DVD1.iso /mnt
#mkdir -p /var/ftp/sles12-64/
#cp -rf /mnt/* /var/ftp/sles12-64/
#mkdir -p /var/ftp/tftpboot/sles12-64/
#cp -rf /var/ftp/sles12-64/boot/x86_64/loader/linux /var/ftp/sles12-64/
#cp -rf /var/ftp/sles12-64/boot/x86_64/loader/initrd /var/ftp/sles12-64/
#umount /mnt

III.Setup and Verify the Configuration about the Services

4) 設定TFTP、NFS與HTTP的Share Folder以及相關設定(vsftpd預設目錄即為/var/ftp/,所以直接啟動目錄即可)
#vi /etc/xinetd.d/tftp -> Modify the parameter about the line of 'Disable = no'
#service xinetd start
#chkconfig xinetd on
#vi /etc/exports
/var/ftp *(ro,all_squash)
#service nfs start
#chkconfig nfs-server on
#vi /etc/httpd/conf/httpd.conf
DocumentRoot "/var/ftp"
Options FollowSymLinks Indexes
AllowOverride None
#service httpd start
#chkconfig httpd on
#service vsftpd start
#chkconfig vsftpd on

5) 設定DHCP Server與PXE相關的設定
#vi /etc/dhcp/dhcpd.conf -> You can refer the file with '/usr/share/doc/dhcp-/dhcp.conf.sample'
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
option domain-name "pxefi.sit.com";
option domain-name-servers 192.168.1.10;
default-lease-time 600;
max-lease-time 7200;
authoritative;
#####The followings are mandatory to be able to boot from PXE ######
allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
next-server 192.168.1.10;
#option space PXE;
#option PXE.mtftp-ip
code 1 = ip-address;
#option PXE.mtftp-cport code 2 = unsigned integer 16;
#option PXE.mtftp-sport code 3 = unsigned integer 16;
#option PXE.mtftp-tmout code 4 = unsigned integer 8;
#option PXE.mtftp-delay code 5 = unsigned integer 8;
#RFC 4578
option client-architecture code 93 = unsigned integer 16;
# 00:06 For UEFI 32 bits
if option client-architecture = 00:07 {
#UEFI Client
filename "/BOOTX64.efi";
} else if option client-architecture = 00:00 {
filename "/pxelinux.0";
}
######################################
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.100 192.168.1.150;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}
#service dhcpd start
#chkconfig dhcpd on

6) 驗證PXE Server相關的服務是否都已Ready(DHCP、NFS、TFTP and etc)
#tftp 192.168.1.10 -> Self Test for the tftp service
>get BOOTX64.efi
>quit
#mount 192.168.1.10:/var/ftp /mnt
#mount | grep '/mnt'
#netstat -tunpl -> Query the ports about above services that is be listed in.(EX:TFTP-69、DHCP-67、NFS-2049、HTTP-80、VSFTP-21 and etc.)

◎、如果要使用RHEL 7.0 x64 Image裡面的BOOTX64.efi,需注意是否NIC OpROM有無Support(EX:RHEL6.5的BOOTX64.efi可以開,但RHEL 7.0的卻會卡在Grub互動Shell內)!
◎、以上就是在RHEL7.0 x64上架設RHEL 7.0/SLES 12 RC1的UEFI PXE Server,至於其他OS的部分(EX:Ubuntu等)就等有碰到在補上來吧,除此之外,如果想要查詢其他關於PXE架設的手法可以參考RHEL7的官方文件,先到這,收工!

  1. 可能這篇沒有詳載遇到有 Secure Boot的時候該怎麼辦,不然應該早就架起來了

  2. Secure boot可以用shim.efi來呼叫grubx64.efi

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
This site is protected by WP-CopyRightPro