PXE+Kickstart自动化安装RHEL7.9系统
一、环境准备1.rhel7 主机2.关闭防火墙和 selinux3.开启主机图形 init 5 开启图形有图形界面可不做# 最小化安装可以yum安装以下图形界面 yum group install Server with GUI -y # 开启图形界面 init 54.配置网络可用5.关闭 VMware dhcp 功能二、配置 Kickstart2.1.安装 Kickstart 工具下载安装 Kickstart注意RHEL7.9后 就没有 system-config-kickstart 工具yum install system-config-kickstart -y启动 Kickstartsystem-config-kickstart修改 ks.cfg 文件添加上需要安装的软件vim ks.cfg2.2.HTTP 搭建安装源安装 httpdyum install httpd -y查看 /dev/sr0 挂载的目录把目录链接到 /var/www/html/ 下[rootrhel-7-server ~]# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 914520 0 914520 0% /dev tmpfs 931512 0 931512 0% /dev/shm tmpfs 931512 10536 920976 2% /run tmpfs 931512 0 931512 0% /sys/fs/cgroup /dev/mapper/rhel-root 14665728 4925284 9740444 34% / /dev/sda1 2086912 187108 1899804 9% /boot /dev/sr0 4420474 4420474 0 100% /mnt tmpfs 186304 24 186280 1% /run/user/0 [rootrhel-7-server ~]# ln -s /mnt/ /var/www/html/ [rootrhel-7-server ~]# cd /var/www/html [rootrhel-7-server html]# ls mnt把 ks.cfg 文件通过 httpd 共享到网络以供使用[rootrhel-7-server ~]# ls anaconda-ks.cfg Documents initial-setup-ks.cfg Music Public Videos Desktop Downloads ks.cfg Pictures Templates [rootrhel-7-server ~]# vim ks.cfg [rootrhel-7-server ~]# ls anaconda-ks.cfg Documents initial-setup-ks.cfg Music Public Videos Desktop Downloads ks.cfg Pictures Templates [rootrhel-7-server ~]# mv ks.cfg /var/www/html/ [rootrhel-7-server ~]# cd /var/www/html [rootrhel-7-server html]# ls ks.cfg mnt开启 httpdsystemctl enable --now httpd通过浏览器查看是否搭建好安装源三、搭建 DHCP 服务器IP 地址分配为客户端自动分配 IP 地址使无盘或未安装系统的设备能接入网络。PXE 引导参数传递通过 DHCP 协议的 next-server 和 filename 选项告知客户端next-serverTFTP 服务器的 IP 地址。filenamePXE 引导文件如 pxelinux.0在 TFTP 服务器上的路径。下载安装DHCPyum install dhcp -y复制 DHCP 配置文件模板到 /etc/dhcp/dhcp.conf\cp -f /usr/share/doc/dhcp*/dhcpd.conf.example /etc/dhcp/dhcpd.conf编辑DHCP配置文件vim /etc/dhcp/dhcpd.conf option domain-name haha.org; option domain-name-servers 223.5.5.5; default-lease-time 600; max-lease-time 7200; log-facility local7; subnet 192.168.67.0 netmask 255.255.255.0 { range 192.168.67.20 192.168.67.30; option routers 192.168.67.2; next-server 192.168.67.156; filename pxelinux.0; }开启DHCPsystemctl enable --now dhcpd四、搭建 TFTP 服务器4.1.THTP 简介TFTP作用传输引导文件通过简单的无认证文件传输协议TFTP向客户端提供以下文件PXE 引导文件如 pxelinux.0由 Syslinux 提供。内核与初始化镜像如 vmlinuzLinux 内核和 initrd.img初始化内存盘。配置文件如 pxelinux.cfg/default启动菜单配置文件。典型文件结构/var/lib/tftpboot/ ├── pxelinux.0 # Syslinux 提供的 PXE 引导程序 ├── vmlinuz # Linux 内核 ├── initrd.img # 初始化内存镜像 └── pxelinux.cfg/ └── default # 启动菜单配置文件下载安装TFTPyum install tftp-server -y4.2.Syslinux 简介Syslinux作用提供 PXE 引导程序生成 pxelinux.0 文件作为 PXE 启动的引导加载程序Bootloader。配置启动菜单通过 pxelinux.cfg/default 文件定义启动选项例如加载内核和初始化镜像。指定 Kickstart 自动安装配置文件ks.cfg的路径。下载安装Syslinuxyum install syslinux -y4.3.搭建服务器复制 ISO 文件到 TFTP 目录从 Syslinux 复制 PXE 引导文件cp /mnt/isolinux/* /var/lib/tftpboot/ cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/创建 TFTP 根目录复制启动菜单文件cd /var/lib/tftpboot/ mkdir pxelinux.cfg cp isolinux.cfg pxelinux.cfg/default配置启动菜单文件注意保存文件时用wqvim pxelinux.cfg/default default vesamenu.c32 timeout 60 display 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 line label linux menu label ^Install Red Hat Enterprise Linux 7.9 kernel vmlinuz menu default append initrdinitrd.img repohttp://192.168.67.156/mnt kshttp://192.168.67.156/ks.cfg quiet label check menu label Test this ^media install Red Hat Enterprise Linux 7.9 kernel vmlinuz append initrdinitrd.img inst.stage2hd:LABELRHEL-7.9\x20Server.x86_64 rd.live.check quiet menu separator # insert an empty line # utilities submenu menu begin ^Troubleshooting menu title Troubleshooting label vesa menu indent count 5 menu label Install Red Hat Enterprise Linux 7.9 in ^basic graphics mode text help Try this option out if youre having trouble installing Red Hat Enterprise Linux 7.9. endtext kernel vmlinuz append initrdinitrd.img inst.stage2hd:LABELRHEL-7.9\x20Server.x86_64 xdrivervesa nomodeset quiet label rescue menu indent count 5 menu label ^Rescue a Red Hat Enterprise Linux system text help If the system will not boot, this lets you access files and edit config files to try to get it booting again. endtext kernel vmlinuz append initrdinitrd.img inst.stage2hd:LABELRHEL-7.9\x20Server.x86_64 rescue quiet label memtest menu label Run a ^memory test text help If your system is having issues, a problem with your systems memory may be the cause. Use this utility to see if the memory is working correctly. endtext kernel memtest menu separator # insert an empty line label local menu label Boot from ^local drive localboot 0xffff menu separator # insert an empty line menu separator # insert an empty line label returntomain menu label Return to ^main menu menu exit menu end启动 TFTPsystemctl enable --now tftp五、测试新建虚拟机此步骤省略此后不用操作等待自动安装完成等待虚拟机自动启动六、总结

相关新闻

从认证到数据权限:SpringBoot3 + Sa-Token + AOP实现企业级安全体系

从认证到数据权限:SpringBoot3 + Sa-Token + AOP实现企业级安全体系

一、问题背景做企业级应用开发这些年,我见过太多项目把"安全"简化成"加个登录就行"。登录验证只是安全体系的第一道门,真正的企业级安全是一个多层防护体系。之前在给政府客户交付项目时,安全评审环节就遇到过一个尴尬&a…

2026/7/22 16:36:44 阅读更多 →
掌握libcurl:从GET请求到HTTPS验证全解析

掌握libcurl:从GET请求到HTTPS验证全解析

1. 初始化 libcurl 在程序开始时调用一次&#xff1a; #include <stdio.h> #include <curl/curl.h>int main(void) {CURLcode res;res curl_global_init(CURL_GLOBAL_DEFAULT);if (res ! CURLE_OK) {fprintf(stderr, "curl_global_init failed: %s\n",c…

2026/7/23 17:50:49 阅读更多 →
基于二阶锥规划的主动配电网最优潮流求解(Matlab代码实现)

基于二阶锥规划的主动配电网最优潮流求解(Matlab代码实现)

&#x1f468;‍&#x1f393;个人主页 &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&#xff1a;行百里者&#xff0c;半于九十。 &#x1f4cb;&#x1f4…

2026/7/22 16:35:43 阅读更多 →

最新新闻

地理探测器Geodetector_Arcgis Pro 下载学习

地理探测器Geodetector_Arcgis Pro 下载学习

地理探测器Geodetector 工具下载 官网http://www.geodetector.cn/Download.html解压下载的压缩包 直接打开Arcgis Pro参考解压文件中的pdf文件工具使用

2026/7/23 21:42:02 阅读更多 →
从WMS批次到装配位置,追溯链怎样不断开

从WMS批次到装配位置,追溯链怎样不断开

装备制造企业已经有WMS&#xff0c;为什么客户现场报修时仍要翻台账&#xff1f;原因通常不在仓库没有批次&#xff0c;而在批次记录到出库或工单领用就结束了。对工程机械、专用车和成套装备来说&#xff0c;售后真正需要查询的是某一批零部件装到了哪台设备、哪个位置&#x…

2026/7/23 21:42:02 阅读更多 →
递归,分治,DFS,回溯的总结

递归,分治,DFS,回溯的总结

算法的本质就是穷举&#xff0c;“遍历”和“分解问题”是穷举的两大思维模式。 回溯&#xff08;一个传话兵&#xff09;&#xff1a;自始至终只有“一个你在走”。你走进了 A 房间&#xff0c;在墙上写了个字&#xff08;做选择&#xff09;&#xff0c;发现是死胡同&#xf…

2026/7/23 21:42:02 阅读更多 →
labelme免费使用(不是下载exe文件)

labelme免费使用(不是下载exe文件)

下载labelme.exe会出现一个问题就是3天试用然后到期需要续费&#xff0c;我们可以在终端下载免费使用。参考&#xff1a;Labelme安装及使用教程-CSDN博客 如果库是最新的&#xff0c;比如python3.13,按照下面这个方式进行&#xff1a; python -m pip uninstall -y labelme Py…

2026/7/23 21:42:02 阅读更多 →
鸿蒙新特性:@ohos.telephony.radio/sim 蜂窝网络实验室实战 —— 无线技术、信号强度与 SIM 卡

鸿蒙新特性:@ohos.telephony.radio/sim 蜂窝网络实验室实战 —— 无线技术、信号强度与 SIM 卡

引言 移动应用的核心能力依赖网络通信&#xff0c;而蜂窝网络是移动设备最基础的联网方式。无论是即时通讯、视频播放还是在线支付&#xff0c;开发者都需要了解当前设备的无线接入技术&#xff08;2G/3G/4G/5G&#xff09;、信号强度等级、网络注册状态以及 SIM 卡状态。Harmo…

2026/7/23 21:42:01 阅读更多 →
2026年ERP实施服务指南

2026年ERP实施服务指南

在数字经济与智能制造深度融合的2026年&#xff0c;企业资源规划&#xff08;ERP&#xff09;系统已不再是大型企业的专属奢侈品&#xff0c;而是决定中小型制造企业生存与发展的核心基础设施。面对日益复杂的供应链、激烈的市场竞争以及不断攀升的合规成本&#xff0c;一套契合…

2026/7/23 21:41:01 阅读更多 →

日新闻

从单点好评到指数级传播:AI副业主理人必须掌握的4层口碑渗透模型(含ROI测算表)

从单点好评到指数级传播:AI副业主理人必须掌握的4层口碑渗透模型(含ROI测算表)

更多请点击&#xff1a; https://intelliparadigm.com 第一章&#xff1a;从单点好评到指数级传播&#xff1a;AI副业主理人必须掌握的4层口碑渗透模型&#xff08;含ROI测算表&#xff09; 当AI副业主理人不再仅满足于单次服务交付&#xff0c;而是主动构建可复用、可裂变、可…

2026/7/23 0:00:25 阅读更多 →
AI写作开头钩子设计:为什么你的AI文案完读率不足18%?——基于2,346篇A/B测试报告的归因分析

AI写作开头钩子设计:为什么你的AI文案完读率不足18%?——基于2,346篇A/B测试报告的归因分析

更多请点击&#xff1a; https://codechina.net 第一章&#xff1a;AI写作开头钩子设计&#xff1a;为什么你的AI文案完读率不足18%&#xff1f;——基于2,346篇A/B测试报告的归因分析 在对2,346篇跨行业AI生成文案的A/B测试数据进行聚类分析后&#xff0c;我们发现&#xff1…

2026/7/23 0:01:26 阅读更多 →
Chitchatter完整指南:免费开源的终极点对点安全聊天工具

Chitchatter完整指南:免费开源的终极点对点安全聊天工具

Chitchatter完整指南&#xff1a;免费开源的终极点对点安全聊天工具 【免费下载链接】chitchatter Secure peer-to-peer chat that is serverless, decentralized, and ephemeral 项目地址: https://gitcode.com/gh_mirrors/ch/chitchatter Chitchatter是一款革命性的安…

2026/7/23 0:01:26 阅读更多 →

周新闻

Go语言静态资源打包方案对比与实践指南

Go语言静态资源打包方案对比与实践指南

1. 项目背景与核心需求在Go语言开发中&#xff0c;我们经常需要处理静态资源文件的打包问题。无论是Web应用的模板文件、前端资源&#xff0c;还是配置文件、证书等&#xff0c;都需要随程序一起分发。传统做法是将这些文件与编译后的二进制文件放在同一目录下&#xff0c;但这…

2026/7/22 8:58:19 阅读更多 →
Go语言实现高性能LDAP认证服务的架构与实践

Go语言实现高性能LDAP认证服务的架构与实践

1. 项目背景与核心价值LDAP&#xff08;轻量级目录访问协议&#xff09;作为企业级身份认证的黄金标准&#xff0c;已经服务了超过80%的财富500强公司。我在金融科技领域实施统一认证体系时&#xff0c;发现传统Java方案存在启动慢、内存占用高等痛点。而Go语言凭借其协程并发模…

2026/7/22 19:43:43 阅读更多 →
【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

【AI面试官实战指南】:用ChatGPT模拟10类高频技术岗面试,3天提升应答精准度92%

更多请点击&#xff1a; https://intelliparadigm.com 第一章&#xff1a;AI面试官实战指南的核心价值与适用场景 AI面试官并非替代人类HR的“黑箱工具”&#xff0c;而是以可解释、可审计、可迭代的方式&#xff0c;赋能招聘全链路的关键基础设施。其核心价值在于将主观经验沉…

2026/7/23 17:49:47 阅读更多 →

月新闻