基于Ubuntu18.04 tftp+apache2+grub+nfs搭建PXE系统(EFI模式,手动安装)
注:用于支持个性系统安装需求
apt-get install tftpd-hpa
apt-get install apache2
apt-get install nfs-kernel-server
mkdir /iso
mount -o loop ubuntu-18.04.6-server-amd64.iso /iso
rsync -av --progress /iso/install /var/lib/tftpboot/
rsync -av --progress /iso/boot/grub /var/lib/tftpboot/
mkdir /var/www/html/ks/UBT18046-x86_64 -p
rsync -av --progress /iso/* /var/www/html/ks/UBT18046-x86_64/
vi /etc/exports
/var/www/html/ks *(rw,async,no_root_squash,insecure)
:wq
/etc/init.d/nfs-kernel-server restart
apt-get install shim-signed grub-efi-amd64-signed
mkdir -p /var/lib/tftpboot/grub
cp -rv /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed /var/lib/tftpboot/grubx64.efi
cp -rv /usr/lib/shim/shimx64.efi.signed /var/lib/tftpboot/grub/BOOTx64.efi
vi /var/lib/tftpboot/grub/grub.cfg
if loadfont /grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=-1 (-1代表需要手动回车,以免正常服务器重启被误重装)
menuentry "Ubuntu Server 18.04.6 ISO" {
set gfxpayload=keep
linux /install/netboot/ubuntu-installer/amd64/linux netcfg/disable_autoconfig=true mirror/country=manual mirror/http/hostname=10.0.0.5 mirror/http/directory=/ks/UBT18046-x86_64 live-installer/net-image=http://10.0.0.5/ks/UBT18046-x86_64/install/filesystem.squashfs netboot=nfs nfsroot=10.0.0.5:/var/www/html/ks/UBT18046-x86_64 --- quiet
initrd /install/netboot/ubuntu-installer/amd64/initrd.gz
}
:wq!
DHCP设置为grubx64.efi
PXE过程中到配置软件源的时候如果出现Downloading a file failed,可以点击Cancel—Save debug logs—web(查看报错log),如果系统装好了,可以在系统/var/log/installer/syslog看log
标签:grub,lib,efi,apache2,EFI,64,install,var From: https://blog.51cto.com/yangzhiming/5935005