(一)基础介绍与环境配置
PXE(Preboot eXecute Environment,预启动执行环境)是由 Intel 公司开发的技术,可以让计算机通过网络来启动操作系统(前提是计算机上安装的网卡支持 PXE 技术),主要用于在无人机值守安装系统中引导客户端主机安装 Linux 操作系统。Kickstart 是一种无人值守的安装方式,其工作原理是预先把原本需要运维人员手工填写的参数保存成一个ks.cfg 文件,当安装过程中需要填写参数时则自动匹配 Kickstart 生成的文件。所以只要使用 PXE+Kickstart 无人值守安装服务 。Kickstart 文件包含了安装过程中需要人工填写的所有参数,那么从理论上来讲完全不需要运维人员的干预,就可以自动完成安装工作。
- PXE的工作过程
PXE 部署拓扑图:
【本次实验因为资源不足的原因将服务器的功能集成到一台服务器中】
- 实验环境如下
主机名称 | 操作系统 | IP地址 | 备注 |
Server | CentOS 8.3 | IP:172.25.200.100/24 gateway:172.25.100.254 dns:172.25.200.100 | 使用Apache 站点作为系统安装文件获取的方式 |
Client | none |
(二) 实验操作-单系统安装
1.初始化环境
2.配置DHCP服务
3.TFTP服务配置
4.SYSLinux 配置
5.Apache 配置
6.编辑ks文件
7.安装测试
- 创建好后进行开机,【注意:网卡模式需与PXE 服务器相同】
(三) 扩展实验—多系统安装
1.添加一个光驱,放入CentOS7的镜像
如图:
2.拷贝镜像文件,修改引导文件
3.安装测试
步骤和刚刚差不多,如下
启动后可以看到,有一个安装菜单,选择第二个选项,进行安装CentOS 7
等待安装完成即可
(四) 踩坑记录
1.无法找到DHCP服务器
如下截图:
解决如下:
2.设备空间不足
错误截图:
原因:因设备空间,如内存或者硬盘等空间太小,导致无法分配资源
解决方法:在虚拟机中扩大内存和硬盘容量
3.设置安装源/软件选择出错
报错如下:
原因:
这个是因为我们没有把/mnt/cdrom的隐藏文件拷走,这是8版本以后才有的问题
-r--r--r--. 1 root root 44 11月 18 2020 .discinfo -r--r--r--. 1 root root 1520 11月 18 2020 .treeinfo
解决:
(五)扩展—引导配置文件解析
1.ks.文件:
注意:软件包段和脚本段必须以%end 结尾
2.default 文件
参考文献如下:
《Linux就该怎么学》—19章
PXE配置中ks.cfg文件介绍_Filter_CPH的博客-CSDN博客
pxe-多系统选择安装_pxe 多系统_SkywrathKreys的博客-CSDN博客
Pxe无人值守安装linux(对default文件有较详细的解释)_pxe default_Linucle的博客-CSDN博客