PXE(预启动执行环境,在操作系统之前运行)是由Intel公司开发的网络引导技术,工作在Client/Server模式,允许客户机通过网络从远程服务器下载引导镜像,并加载安装文件或者整个操作系统。 安装软件包
yum install dhcp tftp-server httpd syslinux -y
配置dhcp服务器
vim /etc/dhcp/dhcpd.conf
# A slightly different configuration for an internal subnet.
subnet 192.168.150.0 netmask 255.255.255.0 {
range 192.168.150.5 192.168.150.100;
default-lease-time 7200;
filename "pxelinux.0";
next-server 192.168.150.130;
}
配置tftp服务器
vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
systemctl start tftp.socket
systemctl status tftp.socket
systemctl enable tftp.socket
拷贝pxe配置文件到/var/lib/tftpboot/
复杂引导文件
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
复杂菜单文件
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
复制系统iso进行中的引导文件
cp /iso/centos7/isolinux/vmlinuz /var/lib/tftpboot/
cp /iso/centos7/isolinux/initrd.img /var/lib/tftpboot/
[root@PXE-Server tftpboot]# ll
总用量 57820
-rw-r--r-- 1 root root 52893200 3月 3 14:23 initrd.img
-rw-r--r-- 1 root root 55140 3月 3 14:20 menu.c32
-rw-r--r-- 1 root root 26759 3月 3 14:19 pxelinux.0
-rwxr-xr-x 1 root root 6224704 3月 3 14:23 vmlinuz
制作安装菜单文件,default文件
cd /var/lib/tftpboot/pxelinux.cfg/
[root@PXE-Server pxelinux.cfg]# cat default
default menu.c32
timeout 300
prompt 0
label 1
menu label ^1) Install CentOS7
menu default
kernel vmlinuz
append initrd=initrd.img method=http://192.168.150.130/Centos7 ks=http://192.168.150.130/ks.cfg
default文件
[root@PXE-Server pxelinux.cfg]# cat default
default menu.c32
timeout 300
##自动使用标记2的引导文件
default 2
prompt 0
label 1
menu label ^1) Install CentOS7
kernel vmlinuz
append initrd=initrd.img method=http://192.168.150.130/Centos7 ks=http://192.168.150.130/ks.cfg
label 1
menu label ^1) Install CentOS7
kernel vmlinuz
append initrd=initrd.img method=http://192.168.150.130/Centos7 ks=http://192.168.150.130/ks.cfg
[root@localhost html]# vim ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
url --url http://192.168.100.99/Centos7
#cdrom
# Use graphical install
#graphical
text
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language
lang zh_CN.UTF-8
# Network information
network --bootproto=dhcp --device=ens33 --ipv6=auto --activate
#network --bootproto=dhcp --device=ens34 --onboot=off --ipv6=auto
network --hostname=localhost.localdomain
# Root password
rootpw --iscrypted $6$Kpvt9o9VbrsruMFF$AWfNRZ5aGsq0flAPkknpcEPjHDbB9QRda287SSgR4dvBwb0xtZaCt7u1iM0kDnEqQmDrFbADDEUEmvQwCrfka/
# System services
services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel
%packages
@^minimal
@core
chrony
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end
reboot
配置http服务器,通过http访问iso文件
把安装iso的文件拷贝到html目录
通过http://IP/Centos7
cd /var/www/html/
标签:default,http,部署,menu,192.168,--,服务器,root,PXE From: https://www.cnblogs.com/haodeng/p/17046859.html