架构一、无人值守PXE+KS

本文详细介绍如何通过PXE和Kickstart实现Linux系统的无人值守批量安装,包括配置网络、DHCP、FTP、TFTP服务,以及使用kickstart文件自动化安装流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PXE+KS 无人值守

前提需求:

①:网络适配器模式都需相同
②:在虚拟网络编辑器中取消DHCP勾选服务
③:在环境中配置本地yum源
④:dhcp是用来分配IP来获取pxe上共享的文件
⑤:使用ftp传输(ftp传输需要客户端的应答因此需要tftp)
⑥:tftp是一种更加便捷的传输,在传输过程中不需要对方回应(使用的是UDP传输‘QQ、微信就是使用的这种协议’)
⑦:xinetd是tftp的守护进程,端口为69

[root@localhost ~]# yum -y install dhcp vsftpd tftp-server xinetd syslinux                首先下载所需服务
[root@localhost ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf  把dhcp的模板拷贝一份
cp:是否覆盖"/etc/dhcp/dhcpd.conf"? y
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf                                              详细配置请看1
[root@localhost ~]# mkdir -p /var/ftp/redhat                                              创建一个ftp传输镜像库
[root@localhost ~]# mount --bind /yum/ /var/ftp/redhat/                                   把镜像绑定到仓库
[root@localhost ~]# mkdir -p /tftpboot/pxelinux.cfg                                       递归创建两个目录
[root@localhost ~]# \cp -a /yum/isolinux/* /tftpboot/                                     递归拷贝并保持属性不变
[root@localhost ~]# \cp -a /usr/share/syslinux/pxelinux.0 /tftpboot/                      拷贝执行文件
[root@localhost ~]# mv /tftpboot/isolinux.cfg /tftpboot/pxelinux.cfg/default              移动配置文件并改名
[root@localhost ~]# vim /tftpboot/pxelinux.cfg/default                                    修改配置文件,详情2 
[root@localhost ~]# vim /etc/xinetd.d/tftp                                                修改tftp配置文件详情3
[root@localhost ~]# yum -y install system-config-kickstart.noarch                         使用KS生成ks.cfg文件
[root@localhost ~]# system-config-kickstart
[root@localhost ~]# vim anaconda-ks.cfg                                                   从其中复制安装时所需安装哪些包
[root@localhost ~]# vim ks.cfg  写入
[root@localhost ~]# cp ks.cfg /var/ftp/ks.cfg                                             拷贝到指定目录下
[root@localhost ~]# systemctl restart dhcpd                      启动
[root@localhost ~]# systemctl restart vsftpd                     启动
[root@localhost ~]# systemctl restart xinetd                     启动
[root@localhost ~]# firewall-cmd --add-port=69/udp
success                                                          放行端口
[root@localhost ~]# firewall-cmd --reload 
success                                                          重新识别

1、 vim /etc/dhcp/dhcpd.conf

subnet 192.168.1.0 netmask 255.255.255.0 {
    option routers 192.168.1.2;
    range 192.168.1.101 192.168.1.166;
    next-server 192.168.1.100;
    filename "pxelinux.0";
}                    租约时间也要修改

在这里插入图片描述

2、vim /tftpboot/pxelinux.cfg/default 配置详情

timeout 6  设置超时时间越小等待时间越短,以毫秒为单位
label linux Redhat
  menu label ^Install Red Hat SZD
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=ftp://192.168.1.100/ks.cfg quiet
  需要删除与上面一起的下一个label或者在initrd.img后面添加inst.stage2=ftp://192.168.1.100  后才能识别
  append initrd=initrd.img  inst.stage2=ftp://192.168.1.100ks=ftp://192.168.1.100/ks.cfg quiet   
  不按上述操作会出现
  Warning:dracut-initqueue timeout - starting timeout scripts

在这里插入图片描述

3、vim /etc/xinetd.d/tftp 修改tftp配置文件详情

在这里插入图片描述
PXE-E32: TFTP
问题所在防火墙沙盒权限问题在这里插入图片描述
在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值