PXE——安装,配置,测试(rhel7环境下)

embedded/2024/9/24 16:27:14/

什么是PXE

        PXE(Preboot eXecution Environment,预启动执行环境)允许计算机在开机时从网络而非本地硬盘或其他存储设备启动。这种技术主要用于网络启动和自动化安装系统,尤其在需要为大量计算机同时安装操作系统的情况下非常有用。

安装需求

  • VMware虚拟机
  • rhel7镜像

VMware安装虚拟机

   可参照以下链接http://t.csdnimg.cn/urI7dicon-default.png?t=N7T8http://t.csdnimg.cn/urI7d

安装所需软件 

sudo yum install -y dhcp tftp-server httpd syslinux system-config-kickstart

查看本机IP和网关

本机ip: 

[root@192 ~]# hostname -i
192.168.242.131

本机网关:

[root@192 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.242.2   0.0.0.0         UG    100    0        0 ens33
192.168.242.0   0.0.0.0         255.255.255.0   U     100    0        0 ens33

配置HTTPD

mount /rhel7 /var/www/html/rhel7

配置DHCP服务

vim /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
## option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers 114.114.114.114;default-lease-time 600;
max-lease-time 7200;# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.#subnet 10.152.187.0 netmask 255.255.255.0 {
#}# This is a very basic subnet declaration.
subnet 192.168.242.0 netmask 255.255.255.0{range 192.168.242.50 192.168.242.60;option routers 192.168.242.2;next-server 192.168.242.131;filename "pxelinux.0";
}
#重启dhcp服务
systemctl restart dhcpd

配置TFTP服务

#启动tftp服务
systemctl enable --now tftp
#挂载本地镜像
mkdir /rhel7
mount /dev/sr0 /rhel7
cp /rhel7/isolinux/*  /var/lib/tftpboot/
cp /usr/share/syslinux/pxelinux.0  /var/lib/tftpboot/
cd /var/lib/tftpboot/
mkdir pxelinux.cfg
cp isolinux.cfg pxelinux.cfg/default
vim /var/lib/tftpboot/pxelinux.cfg/default
#配置文件如下
default vesamenu.c32
timeout 30display boot.msg# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title Red Hat Enterprise Linux 7.9
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13# Border Area
menu color border * #00000000 #00000000 none# Selected item
menu color sel 0 #ffffffff #00000000 none# Title bar
menu color title 0 #ff7ba3d0 #00000000 none# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none# Help text
menu color help 0 #ffffffff #00000000 none# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.menu tabmsg Press Tab for full configuration options on menu items.menu separator # insert an empty line
menu separator # insert an empty linelabel linuxmenu label ^Install Red Hat Enterprise Linux 7.9menu defaultkernel vmlinuzappend initrd=initrd.img http://192.168.242.131/rhel7 ks=http://192.168.242.131/ks.cfg  quietlabel checkmenu label Test this ^media & install Red Hat Enterprise Linux 7.9kernel vmlinuzappend initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 rd.live.check quietmenu separator # insert an empty line# utilities submenu
menu begin ^Troubleshootingmenu title Troubleshootinglabel vesamenu indent count 5menu label Install Red Hat Enterprise Linux 7.9 in ^basic graphics modetext helpTry this option out if you're having trouble installingRed Hat Enterprise Linux 7.9.endtextkernel vmlinuzappend initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 xdriver=vesa nomodeset quietlabel rescuemenu indent count 5menu label ^Rescue a Red Hat Enterprise Linux systemtext helpIf the system will not boot, this lets you access filesand edit config files to try to get it booting again.endtextkernel vmlinuzappend initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 rescue quietlabel memtestmenu label Run a ^memory testtext helpIf your system is having issues, a problem with yoursystem's memory may be the cause. Use this utility tosee if the memory is working correctly.endtextkernel memtestmenu separator # insert an empty linelabel localmenu label Boot from ^local drivelocalboot 0xffffmenu separator # insert an empty line
menu separator # insert an empty linelabel returntomainmenu label Return to ^main menumenu exitmenu end

配置kickstart

#启动工具(要安装图像界面)
system-config-kickstart

 

cp /root/ks.cfg /var/www/html

 关闭防火墙selinux启动并启用dhcp,tftp,http服务

sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo setenforce 0
sudo systemctl start dhcpd tftp httpd
sudo systemctl enable dhcpd tftp httpd

测试

 

等待安装,安装完成别忘记把bios里改成硬盘启动


http://www.ppmy.cn/embedded/90767.html

相关文章

图片怎么重命名批量修改?教你几种批量重命名小妙招

图片已成为我们工作、学习和生活中不可或缺的一部分。然而,随着图片数量的激增,如何高效地管理和整理这些图片成为了一个挑战。特别是当需要批量重命名图片时,手动操作不仅费时费力,还容易出错。下面交给大家几种图片批量重名方法…

“程序员面试中的“八股文”:知识与实践的平衡“

"八股文"在程序员面试中通常指的是一系列常见的面试问题和答案,这些问题往往围绕计算机科学的基础知识、编程语言特性、算法和数据结构、设计模式、系统架构等。这些内容是程序员必须掌握的核心知识,也是评估候选人专业能力的重要标准。 首先…

备受争议!如果这本双1区TOP也称“水刊”,那让我发一篇这样的“水一水”吧!

【SciencePub学术】本期,小编给大家推荐1本计算机领域的SCI期刊。隶属于Elsevier 出版社旗下,虽然今年的影响因子略有回落,但仍有7.2分,稳居中科院1区TOP地位,最重要的是国人友好,投稿难度也较小&#xff0…

live2d C++ sdk 分析

从网上收集的live2d模型 可以自己添加新的表情/姿态,不过只能是静态(虽然可以用渐变过渡实现动态效果) 前提要下载官方live2d应用(免费版即可) 双击moc3,会在Cubism Viewer中打开(这是live2d…

Vue + View-ui-plus Upload实现手动上传

本文实现Vue Upload组件多文件手动上传&#xff0c;支持上传图片&#xff08;image&#xff09;、压缩文件(zip/rar)、表格(excel)、pdf 一、dom结构 <Row><Col :span"19"></Col><Col :span"2"><div class"ivu-btn-uplo…

手摸手教你撕碎西门子S7通讯协议16--【爆肝了】通讯库应用开发winform版

1、先爆颜值 前面15讲&#xff0c;让你见识到了通讯库的强大&#xff0c;已经进入收尾阶段&#xff0c;这节来个常规应用&#xff0c;让前面的技能直接飞上天&#xff0c;我们要做的界面软件是这样的&#xff0c;虽然没有潘金莲漂亮&#xff0c;但也是玉女心惊。 2、实现思路 …

《书生大模型实战营第3期》基础岛 第1关 :书生大模型全链路开源体系

文章大纲 简介更新性能基座模型对话模型 依赖使用案例通过 Transformers 加载通过 ModelScope 加载通过前端网页对话 InternLM 高性能部署推理1百万字超长上下文推理 智能体微调&训练评测标准客观评测长文评估&#xff08;大海捞针&#xff09;数据污染评估智能体评估主观评…

技术成神之路:设计模式(十一)迭代器模式

前言 迭代器这个词听到并不陌生吧&#xff0c;我们再开发中遍历HashMap 和 HashSet的时候 用到的迭代器和这里的迭代器是一个概念&#xff0c;当然&#xff0c;这个模式不是教你如何去实现的&#xff0c;而是以了解为主。 介绍 迭代器模式&#xff08;Iterator Pattern&#…