当前位置:网站首页>PXE网络装机
PXE网络装机
2022-07-28 14:39:00 【不会调制解调的猫】
目录
环境准备
安装启用DHCP并配置文件
检查是否安装dhcp,没有则直接yum安装
yum install -y dhcp
复制
cp -rfp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
修改配置文件
vim /etc/dhcp/dhcpd.conf
subnet 192.168.150.0 netmask 255.255.255.0 { #配置IP和子网掩码
range 192.168.150.100 192.168.150.200; #配置地址池
option domain-name-servers 114.114.114.114; #配置域名解析
option routers 192.168.150.1; #配置网关
next-server 192.168.150.1;
filename "pxelinux.0" #配置引导文件
}

配置网卡
配置完成后去添加一块新的网卡

此时我们ifconfig检查一下,会发现多了一块网卡出来

然后我们拷贝一份ens33到ens37里面,并进入ens37网卡里面进行设置

配置TFTP
yum -y install tftp-server
yum -y install xinetd
vim /etc/xinetd.d/tftpservice tftp
{
socket_type = dgram
protocol = udp
wait = yes
//wait no表示客户机可以多台一起连接,yes表示客户机只能一台一台连接,表示是否开启多线程一起工作,否则需要等待
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
//指定TFTP根目录(引导文件的存储路径) -c允许上传
disable = no //修改 disable no表示开启TFTP服务
per_source = 11
//通过限制一个主机的最大连接数,从而防止某个主机独占某个服务,这里每个IP地址的连接数是11个
cps = 100 2
//表示服务器最多启动100个连接,如果达到这个数目将停止启动新服务2秒。在此期间不接受任何请求
flags = IPv4
}systemctl enable tftp
systemctl start tftp引导文件vmlinuz 和 initrd.img
mount /dev/cdrom /mnt
cp /mnt/images/pxeboot/initrd.img vmlinuz /var/lib/tftpboot/ systemctl start xinetd
systemctl enable xinetd
systemctl start tftp
systemctl enable tftp 引导文件pxelinux.0
pxelinux.0是个二进制文件,主要作用相当于一个系统安装步骤的指引,引导客户端如何安装系统
yum provides */pxelinux.0 查找其位置并复制到/var/lib/tftpbooot/
rpm -ql syslinux | grep pxelinux.0
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ 配置启动菜单文件
因为由pxelinux.0这个文件决定是/var/lib/tftpboot/pxelinux.cfg/default文件,所以我们只要在/var/lib/tftpboot/下手动创建
mkdir /var/lib/tftpboot/pxelinux.cfg
vim /var/lib/tftpboot/pxelinux.cfg/default default auto //指定默认入口名称 ,对应下面的label auto
prompt 1
//设置是否等待用户选择,1 表示等待用户控制,0表示不等待用户控制,安装时会出现boot:如果按回车
表示选择auto模式
label auto //默认的图形安装
kernel vmlinuz
append initrd=initrd.img method=ftp://192.168.150.30/centos7
//method必须指定网络路径
label linux text //文本安装模式,出现boot:时输入linux text
kernel vmlinuz
append text initrd=initrd.img method=ftp://192.168.150.30/centos7
label linux rescue //救援模式,出现boot:时输入linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.150.30/centos7 kickstart
安装system-config-kickstart
yum install -y system-config-kickstart
打开Kickstart配置程序窗口








保存至/var/ftp/下,文件名 ks.cfg
可以对ks进行优化
vi /var/lib/tftpboot/pxelinux.cfg/default
default auto
prompt 1
label auto
kernel vmlinuz
append initrd=initrd.img method=ftp://192.168.150.30/centos7 ks=ftp://192.168.100.100/ks.cfg
label linux text
kernel vmlinuz
append text initrd=initrd.img method=ftp://192.168.150.30/centos7 ks=ftp://192.168.100.100/ks.cfg
label linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.150.30/centos7 ks=ftp://192.168.100.100/ks.cfg边栏推荐
- 手把手带你编写一个规范的字符设备驱动
- Installing CONDA and configuring Jupiter
- Endnote is associated with word
- Pytorch - sequential and modulelist
- Try... Except exception handling statement (6)
- 有道云笔记去除底部广告
- 有奖活动分享:使用WordPress搭建一个专属自己的博客后最高可领取iPhone13
- Matlab导出高清图片、且Word中压缩不失真、转换PDF不失真
- 设置结构体字节对齐
- The difference between character array and string
猜你喜欢

Explain the difference set, intersection set and union set of complex type set in detail.Net

NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作

关于Simulink如何生成模型覆盖率报告

800V高压系统

Grpc protocol buffer

一文了解 Rainbond 云原生应用管理平台

Flowable workflow all business concepts

EasyExcel复杂表头导出(一对多)

爆肝整理 JVM 十大模块知识点总结,不信你还不懂

2022年最火的十大测试工具,你掌握了几个
随机推荐
Leetcode - random set, longest multiclass subsequence
软件架构与设计(六)-----层次结构体
Differences between two ways of QT creating folders
如何通过adb打开和关闭飞行模式
Template injection summary
Leetcode - number of operations, non repeating numbers, diagonal traversal, Joseph Ring
Vs dynamic library debugging
3. Basic constants and macro definitions
2. Self narration of open source GPS project hd-gr GNSS
19、通道分配任务定义
Self cultivation of programmers
Sharing of award-winning activities: you can get up to iphone13 after using WordPress to build your own blog
3、基本常数和宏定义
1. Author of the open source GPS project hd-gr GNSS
语音社交系统——完善有声系统产业链
About how Simulink generates model coverage reports
一篇文章了解RSocket协议
Qt创建文件夹的两种方式区别
Easyexcel complex header export (one to many)
Installing CONDA and configuring Jupiter