In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to solve the problems encountered in the process of building PXE server environment". In daily operation, I believe many people have doubts about how to solve the problems encountered in the process of building PXE server environment. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to solve the problems encountered in the process of building PXE server environment". Next, please follow the editor to study!
Problems encountered in environmental preparation
First, you need to mount the system image to / mnt:
# mount / dev/sdd2 / mnt/usb_disk Mount the USB flash drive
# copy cp rhel-server-7.6-x86_64-dvd.iso / home system images locally
# mount-o loop rhel-server-7.6-x86_64-dvd.iso / mnt
Problem: ifconfig command not found
Solution: # cd / sbin to see if there is an ifconfig in this directory. If not, install it.
Installation: # sudo yum install net-tools
Problem: vim command not found
Solution: # rpm-qa | grep vim
Vim-enhanced-7.0.109-7.el5
Vim-minimal-7.0.109-7.el5
Vim-common-7.0.109-7.el5
If any of the above items are missing (such as vim-enhanced-7.0.109-7.el5), execute
# yum-y install vim-enhanced to install
If none of the three items are returned, execute
# yum-y install vim*
Question: how to locate the location of the server's Internet port according to the ifconfig display network port name
# ethtool-p enp24s0
Problem: resolving yum source configuration
# cd / etc/yum.repos.d
# vim base.repo
[base]
Name=redhat
Baseurl= file:///mnt
Gpgcheck=0
Enabled=1
: wq
# yum clean all
# yum makecache
# yum-y install
If there is a problem with the Python version, check the path of the interpreter:
# whereis python
# / usr/lib/python2.6 / usr/lib64/python2.7
# vim / usr/bin/yum
#! / usr/bin/python changed to #! / usr/bin/python2.7
# yum-y install
To boot with PXE:
1. Select the network to start after boot, and the client initiates a dhcp request to obtain the IP address to the dhcpd on the server.
2. After the server side assigns IP, the dhcpd will send the boot file to the client side, namely bootloader, through the TFTP protocol according to its configuration file.
3. For traditional Legacy BIOS, the pxelinux.0 provided by syslinux is generally used to boot. For EFI BIOS, you need to boot using an efi file, and you can generally use Grub2. To implement UEFI SecureBoot, most Linux uses shim.efi nested calls to grub.efi to boot.
4, traditional Legacy BIOS boot, after pxelinux.0 boot, it will request and load the default file in the tftpboot directory on the server side and in the pxelinux.cfg directory in the same directory as pxelinux.0. This file is the boot configuration file of syslinux, which is equivalent to the grub.cfg of grub2.
5, EFI BIOS boot, after the shim.efi nested boot grubx64.efi, it will request the grubx64.efi in the same directory grub.cfg configuration file, while loading and showing the boot menu. For RHEL6, it does not support SecureBoot, so you must use grub-efi 0.97 to boot, usually BOOTX64.efi, and it will request the efidefault configuration file in the same directory to load and display the boot menu.
6. After pxelinux.0/grub loads the boot configuration, you can choose to install the boot entry, which must contain the kernel and initrd, as well as other boot options, such as keyboard, language, remote repo, kickstart configuration file, and so on.
7. After the kernel and initrd are loaded, you can go to the installation interface and install normally.
First, [first of all] find two servers and connect the IPMI ports of the two servers to the same switch at the same time to facilitate PC management:
1. Change the IP adress of IPMI to dynamic allocation, so that the IP of three machines are on the same network segment.
2. Enter BIOS,Server Mgmt--Configuration address source [DHCP]
Server Mgmt--Configuration address source [DynamicBmcDhcp]
Save the restart and enter the Station IP adress under BIOS,BMC Network Configuration to assign the IP to the switch.
The PC side logs in to the BMC IP of Client and Server to manage the interface.
Second, start to build, the server side uses the redhat7.3 system: rhel-server-7.3-x86_64-dvd.iso, through the Legacy mode installation
1. First, find a network card on the server side, use it as a dhcpd, and assign IP to the Client.
# cd / etc/sysconfig/network-scripts
# vim ifcfg-enp24s0
TYPE=Ehernet
DEVICE=enp24s0
BOOTPROTO=static
IPADDR=1.1.1.2
NETMASK=255.255.255.0
ONBOOT=yes
Actual operation diagram:
2. Turn off the firewall and clear the air.
# systemctl stop firewalld.service
# systemctl disable firewalld.service
# iptables-F
# iptables-L-n
3. In order to prevent the lack of the corresponding installation package during the operation, copy the redhat7.3 system image to the system and mount it to the local machine.
# cp rhel-server-7.3-x86_64-dvd.iso / mnt
# mkdir / mnt/rhel7
# mount-o loop rhel-server-7.3-x86_64-dvd.iso / mnt/rhel7
4. Install the software package on the server side
# yum install xinetd tftp tftp-server dhcp syslinux
# rpm-qa xinetd tftp tftp-server dhcp syslinux
# yum install xinetd tftp tftp-server dhcp syslinux
5. Configure the IP of the Server network card, the network segment is the network segment of the DHCP server, and edit the dhcpd.conf file
# cd / etc/dhcp/
# vim dhcpd.conf
Option architecture-type code 93 = unsigned integer 16
Subnet 192.168.3.0 netmask 255.255.255.0
{
Range 192.168.3.10 192.168.3.20
Option routers 192.168.3.3
Next-server 192.168.3.3
Class "pxeclients" {
Match if substring
(option vendor-class-identifier, 0,9) = "PXEClient"
If option architecture-type = 00:07 or option architecture-type = 00:09 {
# EFI BIOS
Filename "images/shim.efi"
# filename "images/BOOTX64.efi"
} else {
# Legacy non-EFI BIOS
Filename "pxelinux.0"
}
}
}
Actual operation diagram:
6. According to the configuration file, dhcp sends the boot file to Client through tftp, and puts all the boot files under the tftpboot file package:
Pxelinux startup (tftp): configuration fil
# mkdir-p / var/lib/tftpboot/pxelinux.cfg # is used to store the default boot file in the system image
# mkdir-p / var/lib/tftpboot/images/rhel7 # is used to store initrd.img and vmlinuz files in the system image
# cp / usr/share/syslinux/pxelinux.0 / var/lib/tftpboot # for traditional LegacyBIOS, generally use the pxelinux.0 boot provided by syslinux
After # cp / mnt/rhel7/isolinux/isolinux.cfg / var/lib/tftpboot/pxelinux.cfg/default # pxelinux.0 boots, request to load the default file in the pxelinux.cfg directory in the same directory as pxelinux.0 in the tftpboot directory on server. This file is the boot configuration file of syslinux, which is equivalent to the grub.cfg of grub2.
# cp / mnt/rhel7/isolinux/boot.msg / mnt/rhel7/isolinux/vesamenu.c32 / var/lib/tftpboot # pxelinux.0/grub after loading the boot configuration, you can choose to install the boot entry, which must include the kernel, initrd, etc.
# cp / mnt/rhel7/isolinux/vmlinuz / mnt/rhel7/isolinux/initrd.img / var/lib/tftpboot/images/rhel7/
# touch / var/lib/tftpboot/images/gurb.cfg # to implement UEFI Secureboot, most Linux use shim.efi nested calls to gurb.cfg to boot
# touch / var/lib/tftpboot/images/efidefault # BOOTX64.efi requests the efidefault configuration file in the same directory while booting, loads and displays the boot menu
# cp / mnt/rhel7/EFI/BOOT/BOOTX64.EFI / var/lib/tftpboot/images/ # RHEL6, it does not support SecureBoot, so it must be booted using gurb-efi 0.97, usually BOOTX64.efi
# cp / boot/efi/EFI/redhat/shim.efi / var/lib/tftpboot/images/ # to implement UEFI SecureBoot, most Linux use shim.efi nested calls gurb.efi to boot
# cp / boot/efi/EFI/redhat/grubx64.efi / var/lib/tftpboot/images/ # EFI BIOS boot. After shim.efi boots grubx64.efi, it requests the grub.cfg configuration file of grubx64.efi in the same directory and loads and displays the boot menu.
If the current server is not installed in RHEL7's EFI mode, you need to extract shim.efi and gurbx64.cfg from the RHEL7 CD.
# cp / mnt/rhel7/Packages/gurb2-efi-2.02-0.44.el7.x86_64.rpm / tmp/
# cp / mnt/rhel7/Packages/shim-0.9-2.el7.x86_64.rpm / tmp/
# rpm2cpio / tmp/gurb2-efi-2.02-0.44.el7.x86_64.rpm | cpio-dimv
# rpm2cpio / tmp/shim-0.9-2.el7.x86_64.rpm | cpio-dimv
# cp / tmp/boot/efi/EFI/redhat/shim.efi / var/lib/tftpboot/images/
# cp / tmp/boot/efi/EFI/redhat/gurbx64.efi / var/lib/tftpboot/images/
# tree / var/lib/tftpboot
Actual operation diagram:
7. Edit the tftp configuration file of xinted to make tftp server effective
# vim / etc/xinted.d/tftp
Change disable = yes to disable = no, save and exit
Actual operation diagram:
8. Use NFS export to go out the mount directory of RHEL installation CD
# vim / etc/exports
/ mnt/rhel7 * (ro)
/ mnt/ * (ro)
Actual operation diagram:
9. Restart the necessary services
# systemctl restart dhcpd
# systemctl restart xinetd
# systemctl restart nfs
# systemctl status dhcpd # check whether xinetd and nfs are active
10. For PXE boot installation in Legacy BIOS mode, after obtaining the address through DHCP, the client will get pxelinux.0 the boot file through the TFTP protocol, and then continue the default file in the get pxelinux.cfg directory. After loading, the boot menu is displayed. The following is a detailed example of the / pxelinux.cfg/default boot configuration file. Add the following label to the original configuration before menu end:
# vim / var/lib/tftpboot/pxelinux.cfg/default
Label rhel7+pxe
Menu label ^ Install RHEL7.3 via PXE+Kickstart
Menu default
Kernel images/rhel7/vmlinuz
Append initrd=images/rhel7/initrd.img inst.repo=nfs:192.168.3.3:/mnt/rhel7/
Actual operation diagram:
The above manual installation is PXE+NFS boot. If you want to use Kickstart automatic installation, you need to modify the above configuration:
# vim / var/lib/tftpboot/pxelinux.cfg/default
Label rhel7+pxe
Menu label ^ Install RHEL7.3 via PXE+Kickstart
Menu default
Kernel images/rhel7/vmlinuz
Append initrd=images/rhel7/initrd.img inst.ks=nfs:192.168.3.3:/mnt/rhel7/
11. For RHEL7 PXE boot in EFI mode, dhcpd.conf is required to specify filename "images/shim.efi" to support UEFI SecureBoot. After loading the shim.efi through TFTP, the gurbx64.efi in the boot pass directory will continue to be nested loaded, and then gurb will get the grub.cfg in the same directory to display the boot menu. The following is a detailed example of / var/lib/tftpboot/images/gurb.cfg configuration:
# vim / var/lib/tftpboot/images/gurb.cfg
Menuentry 'Install RHEL 7.3 via [UEFI] PXE+Kickstart' {
Linuxefi images/rhel7/vmlinuz inst.repo=nfs:192.168.3.3:/mnt/rhel7/ # remember that there are no spaces on both sides of the equal sign
Initrdefi images/rhel7/initrd.img
}
Actual operation diagram:
If you want to install RHEL7 automatically using Kickstart, please refer to
# vim / var/lib/tftpboot/images/gurb.cfg
Menuentry 'Install RHEL 7.3 via [UEFI] PXE+Kickstart' {
Linuxefi images/rhel7/vmlinuz inst.ks=nfs:192.168.3.3:/mnt/rhel7/
Initrdefi images/rhel7/initrd.img
}
For system installation of redhat6, you need
12. For RHEL6 PXE boot in EFI mode, you need dhcpd.conf to specify filename "image/BOOTX64.efi", which is actually grub 0.97. After loading BOOTX64.efi through TFTP, it continues to load the efidefault boot configuration file in the same directory and displays the boot menu. The following is a detailed example of / var/lib/tftpboot/images/efidefault configuration:
# vim / var/lib/tftpboot/images/efidefault
Default=0
Timeout=3
Title Install RHEL 6.8 via [UEFI] PXE+Kickstart
Root (nd)
Kernel / rhel6/vmlinuz repo=nfs:192.168.3.3:/mnt/rhel6/ ip=dhcp lang=en keymap=us
Initrd / rhel6/initrd.img
Actual operation diagram:
If you want to install RHEL7 automatically using Kickstart, please refer to
Default=0
Timeout=3
Title Install RHEL 6.8 via [UEFI] PXE+Kickstart
Root (nd)
Kernel / rhel6/vmlinuz ks=nfs:192.168.3.3:/mnt/rhel6/ ip=dhcp lang=en keymap=us
Initrd / rhel6/initrd.img
13. Start the client machine to communicate with the server network. Normally, the client should be able to get the IP address, get the corresponding boot file according to TFTP, boot to the default installation interface of RHEL, or start the installation automatically through kickstart.
14. If there is any problem in the whole process, you can check the server log. Every time / var/log/messages,dhcpd assigns an address to PXE, tftp sends a file to client, and the directory where NFS is mounted on client, it will be recorded in this file.
At this point, the study on "how to solve the problems encountered in the process of building the PXE server environment" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.