搭建华为UOS PXE服务器
必要软件
apt install net-tools dnsmasq nfs-kernel-server
文件复制
#nfs
mkdir /mnt/uos /mnt/nfs /tftpboot
mount ***.ISO /mnt/uos
cp /mnt/uos/* /mnt/nfs/ -r
chown root:root /mnt/nfs -R
find /mnt/nfs -type d -exec sudo chmod 755 {} \;
echo '/mnt/nfs *(ro,sync,no_subtree_check)' |sudo tee -a /etc/exports
#tftpboot
cp /mnt/uos/EFI /tftpboot -r
cp /mnt/uos/boot /tftpboot -r
cp /mnt/uos/kernel /tftpboot
cp /mnt/uos/live /tftpboot -r
/etc/dnsmasq.conf 配置
ls=root #设置绑定⽤⼾和⽤⼾组
group=root
listen-address=127.0.0.1,192.168.0.1
#绑定的⽹卡
interface=enp8s0
bind-interfaces
#IP 分配范围 192.168.0.50,192.168.0.150, dhcp 租期 1⼩时
dhcp-range=192.168.0.20,192.168.0.200,6h
#⽹关
dhcp-option=3,192.168.0.1
#DNS
dhcp-option=6,192.168.0.1
#转发 dns 请求到上级服务器
server=114.114.114.114
#⼴播地址
dhcp-option=28,192.168.0.255
#NTP 服务器,0.0.0.0 指向⾃⼰
dhcp-option=42,0.0.0.0
#tftp 启动⽂件,这个⽂件是相对于 tftp 根⽬录的
#判断不同的客户端(BIOS 客户端,EFI 客户端)
#dhcp-match=set:bios,60,PXEClient:Arch:00000
#dhcp-boot=tag:bios,bios/pxelinux.0
#dhcp-match=set:efibc,60,PXEClient:Arch:00007
#dhcp-boot=tag:efibc,efi/syslinux.efi
#dhcp-match=set:efi,60,PXEClient:Arch:00009
#dhcp-boot=tag:efibc,efi/syslinux.efi
dhcp-boot=boot/efi/grubaa64.efi
#启⽤dnsmasq 内置 tftp 服务
enable-tftp
#tftp 根⽬录
tftp-root=/tftpboot
grub.cfg 配置
注:grub.cfg 目录为/tftpboot/EFI/BOOT/grub.cfg ,不知道为啥 /tftpboot/boot/efi/grub.cfg 没用
insmod net
insmod efinet
insmod tftp
insmod efi_gop
#insmod efi_uga
#insmod chain
net_bootp
set net_default_server=192.168.0.1
set root='(tftp)'
menuentry "Boot From NFS Server" {
set background_color=black
echo 'loading kernel...'
linux /kernel earlycon=pl011,0xFFF02000 maxcpus=8 initcall_debug=y printktimer=0xfa89b000,0x534,0x538 rcupdate.rcu_expedited=1 buildvariant=eng pmu_nv_addr=0x0 boardid=0x2456 normal_reset_type=fastbootd boot_slice=0x107573 reboot_reason=COLD_BOOT exception_subtype=no last_bootup_keypoint=38 swiotlb=2 dma_zone_only=true kce_status=0 efuse_status=2 nokaslr hhee_enable=false console=ttyAMA6,115200 console=tty boot=live netboot=nfs nfsroot=192.168.0.1:/mnt/nfs components quiet toram splash union=overlay livecd-installer locales=zh_CN.UTF-8
initrd /live/initrd.img
echo 'loading initrd.img...'
initrd /live/initrd.img
echo 'finished'
}
此时华为笔记本从pxe启动能正常进入安装界面