当前位置:网站首页>PXE network
PXE network
2022-07-04 15:15:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Catalog
PXE Service construction process
One 、 Install and enable DHCP service
Two 、 Install and enable TFTP service
3、 ... and 、 Get ready PXE Bootstrap pxelinux.0
Four 、 Configure the Startup menu file
5、 ... and 、 install ftp service , Get ready CentOS 7 Install source
6、 ... and 、 Realization Kickstart Unattended installation
PXE Principles and concepts
PXE Strictly speaking, it is not an installation method , It's a way of guiding . Conduct PXE The necessary condition for installation is that the computer to be installed contains a PXE Supported network cards (NIC), That is, there must be PXE Client.PXE (Pre-boot Execution Environment) The protocol enables the computer to start over the network . The agreement is divided into client and server End ,PXE client On the network card ROM in , When the computer boots ,BIOS hold PXE client Call in memory to execute , from PXE client Download the files placed at the remote end to run locally through the network . function PXE The protocol needs to be set DHCP The server and TFTP The server .DHCP The server is used for PXE client( The host on which the system will be installed ) Allocate one IP Address , Because it's for PXE client Distribute IP Address , So in configuration DHCP You need to add the corresponding PXE Set up . Besides , stay PXE client Of ROM in , It already exists TFTP Client.PXE Client adopt TFTP The agreement reached TFTP Server Download the required files .
advantage
scale : Set up multiple servers at the same time ; automation : Install the system 、 Configure various services ; Remote implementation : You don't need a CD 、U Disk and other installation media .
Prerequisite
The client's network card supports PXE agreement ( Integrate BOOTROM chip ), And the motherboard supports network boot . There's one on the Internet DHCP Server to automatically assign addresses to clients 、 Specify the boot file location . Server pass TFTP(Trivial File Transfer Protocol, Simple file transfer protocol ) Download the boot image file . among , The first condition is actually the hardware requirements , At present, most servers and most PC Can provide this support , Just in BIOS Setting allows Network or LAN Start it up .
KickStart summary
KickStart It's a kind of unattended installation .KickStart The working principle is to record various parameters filled in by manual intervention during the typical installation process , And generate a file named ks.cfg The file of ; During the subsequent installation ( It's not just about generating KickStart The machine where the files are installed ) When a parameter is required to be filled , Setup will first find KickStart Generated files , When you find the right parameters , Just use the parameters found , When no suitable parameter is found , It requires manual intervention by the installer . such , If KickStart The file covers all the parameters that need to be filled in during installation , The installer can simply tell the installer where to get ks.cfg file , Then go and do your own thing . After installation , The installation program will follow ks.cfg To restart the system , And end the installation .
PXE Service construction process
1.PXE The client sends DHCP request , towards DHCP Server application IP Address . 2.DHCP Server response PXE Client requests , Automatically from IP Allocate an address in the address pool IP Address to PXE The client , And tell PXE The client :TFTP Server's IP Address and PXE Bootloader file pxelinux.0, Default in TFTP share directory /var/lib/tftpboot/ Next . 3.PXE The client is going to TFTP The server initiates the acquisition pxelinux.0 Request for bootstrap file . 4.TFTP Server response PXE Client requests , Share it pxelinux.0 File transfer to PXE The client . 5.PXE The client starts to the main interface of system installation through the network . 6.PXE Client to file sharing server (ftp、http、nfs etc. ) Initiate acquisition centos or windows Request for system installation files . 7. File sharing service response PXE Client requests , Transfer the shared system installation files to PXE The client . 8.PXE The client enters the installation prompt wizard interface , Users need to manually complete the operation of system installation
PXE The experimental steps
Environmental preparation : One action pxe The server , One as a bare metal client , Bind the same network card , Bare metal client vmnet1 Uncheck the network card dhcp To configure . close selinux And the firewall
Host server address :192.168.253.12 Host name :KY17
A mainframe :1) Configure dual NIC One function is dhcp, One is to use the network source to install the environment package 2)DHCP Deploy 3)tftp-server Server pass TFTP(Trivial File Transfer Protocol, Simple file transfer protocol ) Download the boot image file . 4)syslinux // To provide with pxe The boot program of 5)xinetd // For hosting tftp 6)vsftpd // Used to place the installation image , adopt ftp Access the image installation 7)kickstart // For unattended installation
One 、 Install and enable DHCP service
yum -y install dhcp
cp -rfp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
Make the following settings in the configuration file :
vim /etc/dhcp/dhcpd.conf
ddns-update-style none; // Disable dynamic updates
subnet 192.168.100.0 netmask 255.255.255.0 { // Configure network segment
range 192.168.100.40 192.168.100.50; // Configure address pool
option routers 192.168.100.100; // configure gateway
option domain-name-servers 114.114.114.114;
next-server 192.168.100.100; // Appoint tftp The address of the server (*)
filename "pxelinux.0"; // Appoint pxe The file name of the bootloader (*)
}
systemctl start dhcpd
systemctl enable dhcpd
Two 、 Install and enable TFTP service
yum -y install tftp-server
yum -y install xinetd
vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = no //wait no Indicates that multiple clients can be connected together ,yes Indicates that the client can only be connected to one by one , Indicates whether to enable multithreading to work together , Otherwise you need to wait
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot // Appoint TFTP root directory ( The storage path of the boot file ) -c Allow upload
disable = no //disable no Open for indication TFTP service
per_source = 11 // By limiting the maximum number of connections to a host , So as to prevent a host from monopolizing a service , Every one here IP The number of connections to the address is 11 individual
cps = 100 2 // Indicates that the server can start up at most 100 A connection , If this number is reached, new services will stop starting 2 second . No requests will be accepted during this period
flags = IPv4
}
# Get ready tftp Files that need to be shared
mount /dev/cdrom /mnt
cd /mnt/images/pxeboot/
# Kernel files The kernel initializes the image file /var/lib/tftpboot/ Site
cp initrd.img vmlinuz /var/lib/tftpboot/
systemctl start xinetd
systemctl enable xinetd
systemctl start tftp
systemctl enable tftp
3、 ... and 、 Get ready PXE Bootstrap pxelinux.0
yum provides */pxelinux.0 // Find out which package this file is installed by , Use when not a path and a package */
yum -y install syslinux
rpm -ql syslinux | grep pxelinux # lookup pxe The location of the bootstrap
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ # copy to tftp Under the root directory of , System boot file
Four 、 Configure the Startup menu file
mkdir /var/lib/tftpboot/pxelinux.cfg // Default pxelinux.cfg There is no need to manually create , Note that it is a directory, not a directory .cfg ending
The following is purely manual configuration default Menu file
vim /var/lib/tftpboot/pxelinux.cfg/default
default auto // Specify the default entry name , Corresponding to the following label auto
prompt 1 // Set whether to wait for the user to choose ,1 Wait for user control ,0 Indicates that you do not wait for user control , During installation, there will be boot: Press enter to select auto Pattern
label auto // Default graphics installation
kernel vmlinuz
append initrd=initrd.img method=ftp://192.168.100.100/centos7 //method You must specify a network path
label linux text // Text installation mode , appear boot: Time input linux text
kernel vmlinuz
append text initrd=initrd.img method=ftp://192.168.100.100/centos7
label linux rescue // Rescue mode , appear boot: Time input linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
5、 ... and 、 install ftp service , Get ready CentOS 7 Install source
yum -y install vsftpd
mount /dev/cdrom /mnt
mkdir /var/ftp/centos7
cp -rf /mnt/* /var/ftp/centos7 # Copy the image into it
systemctl start vsftpd
6、 ... and 、 Realization Kickstart Unattended installation
example : Realization Kickstart Unattended installation ( Use desktop environment ) 1、 Prepare to install the answer file yum install -y system-config-kickstart—— Install the software
2、 open “Kickstart Configuration program ” window From the Desktop Menu “ Applications ”–>“ System tools ”–>“Kickstart” open or perform “system-config-kickstart” Command to open
3、 configuration option The default language is set to “ chinese ( Simplified Chinese character )” The time zone is set to “Asia/Shanghai” Set up root password Check... In advanced configuration “ Restart after installation ”.
● Installation method choose FTP FTP The server :ftp://192.168.80.10 FTP Catalog :centos7
● Bootloader options
“ Installation type ”: Install the new bootloader “ Installation options ”: In the master boot record (MBR) Install bootloader in
Master boot record : Clear master boot record Partition : Delete all existing partitions Disk label : Initialize disk label Layout : Add partition Mount point :/boot, File system type :xfs, Fixed size :500M File system type :swap, Fixed size :4096M Mount point :/home, File system type :xfs, Fixed size :4096M Mount point :/, File system type :xfs, Use all unused space on the disk
● The network configuration : Add network devices “ens33” The network type is set to “DHCP”
● Firewall configuration : Ban SELinux、 Disable firewall
● Post install scripts : Check “ Using the interpreter ”:/bin/bash rm -rf /etc/yum.repos.d/* echo ‘[local] name=local baseurl=ftp://192.168.221.20/centos7 enabled=1 gpgcheck=0’ > /etc/yum.repos.d/local.repo
4、 Save auto answer file choice “Kickstart Configuration program ” Window “ file ”–>“ preservation ” command , Select the specified save location , The file named ks.cfg The default is saved in /root/ks.cfg
5、 Configure the installation package According to the need /root/anaconda-ks.cfg Copy the package installation script to ks.cfg In file , Just copy %packages To %end Part can be . cp /root/ks.cfg /var/ftp/ks.cfg
If you need to configure the software package yourself , You need to edit ks.cfg file
vim ks.cfg
Add to last
%packages
@^graphical-server-environment
@base
@core
@desktop-debugging
@development
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@hardware-monitoring
@input-methods
@internet-browser
@multimedia
@print-client
@x11
chrony
%end
If minimum installation is required , You can copy the following content and add it to the end
vim ks.cfg
%packages
@^minimal
%end
6、 Edit the boot menu file default, add to ks Guidance parameters vim /var/lib/tftpboot/pxelinux.cfg/default default auto prompt 0 # Set whether to wait for the user to choose ,“0” Indicates that you do not wait for user control
label auto kernel vmlinuz #kernel and append Used to define the boot parameters append initrd=initrd.img method=ftp://192.168.80.10/centos7 ks=ftp://192.168.80.10/ks.cfg # add to ks Boot parameters to specify ks.cfg Answer file URL route
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/149325.html Link to the original text :https://javaforall.cn
边栏推荐
- Leecode learning notes - Joseph problem
- 深度学习 网络正则化
- Live broadcast preview | PostgreSQL kernel Interpretation Series II: PostgreSQL architecture
- When synchronized encounters this thing, there is a big hole, pay attention!
- Redis哨兵模式实现一主二从三哨兵
- Redis sentinel mode realizes one master, two slave and three Sentinels
- Preliminary exploration of flask: WSGI
- 重排数组
- 干货 | fMRI标准报告指南新鲜出炉啦,快来涨知识吧
- 对话龙智高级咨询顾问、Atlassian认证专家叶燕秀:Atlassian产品进入后Server时代,中国用户应当何去何从?
猜你喜欢
Weekly recruitment | senior DBA annual salary 49+, the more opportunities, the closer success!
Implementation of macro instruction of first-order RC low-pass filter in signal processing (easy touch screen)
MySQL learning notes - data type (numeric type)
深度学习 神经网络的优化方法
Korean AI team plagiarizes shock academia! One tutor with 51 students, or plagiarism recidivist
The per capita savings of major cities in China have been released. Have you reached the standard?
力扣刷题01(反转链表+滑动窗口+LRU缓存机制)
Redis publish and subscribe
Helix Swarm中文包发布,Perforce进一步提升中国用户体验
Five minutes of machine learning every day: why do we need to normalize the characteristics of numerical types?
随机推荐
Helix Swarm中文包发布,Perforce进一步提升中国用户体验
Introduction of text mining tools [easy to understand]
mysql 联合主键_Mysql 创建联合主键[通俗易懂]
Unity预制件Prefab Day04
Redis 发布和订阅
Unity脚本生命周期 Day02
Redis publier et s'abonner
Align left and right!
Force button brush question 01 (reverse linked list + sliding window +lru cache mechanism)
TechSmith Camtasia studio 2022.0.2 screen recording software
%S format character
Deep learning neural network case (handwritten digit recognition)
Decimal, exponential
lnx 高效搜索引擎、FastDeploy 推理部署工具箱、AI前沿论文 | ShowMeAI资讯日报 #07.04
Unity脚本API—Time类
深度学习 网络正则化
Unity脚本介绍 Day01
小数,指数
Memory management summary
%f格式符