1. 基础环境准备
本章节pxe服务器采用centos8系统
系统镜像采用centos7.6-1810arm64 地址在文章最下面
p
首先,确保你的 CentOS 8 服务器已经安装了所需的服务,包括 tftp-server
, httpd
, dhcp-server
, 以及 xinetd
(用于 TFTP 服务)。
# 安装所需软件包
sudo dnf install -y dhcp-server tftp-server httpd xinetd syslinux
# 启动并设置自动启动 TFTP、HTTPD 和 DHCP 服务
sudo systemctl enable --now tftp xinetd dhcpd httpd
2,配置DHCP服务
DHCP 服务为网络中的客户端分配 IP 地址,并告知 PXE 引导文件的位置。
编辑 /etc/dhcp/dhcpd.conf
,根据您的网络拓扑,配置如下:
subnet 192.168.137.0 netmask 255.255.255.0 {
range 192.168.137.100 192.168.137.199;
option subnet-mask 255.255.255.0;
option routers 192.168.137.1;
option domain-name-servers 8.8.8.8;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.137.100;
filename "arm64/grubaa64.efi";
}
3,配置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
}
4,配置PXE启动文件
[root@localhost ~]# mkdir –p /var/lib/tftpboot/arm64
[root@localhost ~]# cp -avf /mnt/EFI/BOOT/* /var/lib/tftpboot/arm64
[root@localhost ~]# cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/arm64
[root@localhost ~]# cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/arm64
root@localhost ~]# ls /var/lib/tftpboot
root@localhost ~]# chmod –R 777 /var/lib/tftpboot
5,配置Grub引导文件
set default="1"
………………
set timeout=30
menuentry 'Install Centos7 Arm64' --class red --class gnu-linux --class gnu --class os {
linux arm64/vmlinuz inst.ks=http://192.168.137.102/ks.cfg inst.repo=http://192.168.137.102/arm64 ro
initrd arm64/initrd.img
}
6,配置KS文件 用于自动化安装
[root@localhost ~]# cp anaconda-ks.cfg /var/www/html/ks.cfg
[root@localhost ~]# vim /var/www/html/ks.cfg
#version=DEVEL
ignoredisk --only-use=sda
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --all --initlabel --drives=sda
# Use text mode install
# Use CDROM installation media
url --url=http://192.168.137.102/arm64
# Keyboard layouts
挂载镜像,并将内容拷贝到/var/www/html/arm64目录中
[root@localhost ~]# mount CentOS-7-aarch64-Everything-1810.iso /mnt
/cdrom
[root@localhost ~]# cp –avf /mnt/* /var/www/html/arm64
[root@localhost ~]# chmod –R 777 /var/www/html/arm64
7.从PXE启动
1、 配置完成后重启服务
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# systemctl restart tftp.service
[root@localhost ~]# systemctl restart http.service
[root@localhost ~]# systemctl restart dhcpd.service
centos7.6arm下载地址
No Comments