当前位置: 首页 > 工具软件 > Syslinux > 使用案例 >

linux pxe节能模式,http+tftp+syslinux 6.x 搭建PXE系统(支持EFI模式)

申屠浩歌
2023-12-01

http+tftp+syslinux 6.x 搭建PXE系统(支持EFI模式):

apt-get install tftpd-hpa

apt-get install apache2

apt-get install make gcc

apt-get install nasm uuid-dev

tar zxfv syslinux-6.03.tar.gz

cd syslinux-6.03

make

make install

非EFI:

mkdir /var/lib/tftpboot/bios

cp -rv syslinux-6.03/bios/core/pexlinux.0 /var/lib/tftpboot/bios/

cp -rv syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 /var/lib/tftpboot/bios/

cp -rv syslinux-6.03/bios/com32/lib/libcom32.c32 /var/lib/tftpboot/bios/

cp -rv syslinux-6.03/bios/com32/libutil/libutil.c32 /var/lib/tftpboot/bios/

cp -rv syslinux-6.03/bios/com32/menu/vesamenu.c32 /var/lib/tftpboot/bios/

cp -rv syslinux-6.03/bios/com32/modules/pxechn.c32 /var/lib/tftpboot/bios/

mkdir /var/lib/tftpboot/bios/pxelinux.cfg

vi /var/lib/tftpboot/bios/pxelinux.cfg/default

DEFAULT vesamenu.c32

TIMEOUT 0

ONTIMEOUT BootLocal

PROMPT 0

MENU TITLE PXE Menu

NOESCAPE 1

LABEL 1. UBT14043-sda

kernel tftp://10.0.0.2/images/UBT14043-x86_64/linux

append initrd=tftp://10.0.0.2/images/UBT14043-x86_64/initrd.gz ksdevice=bootif lang= locale=en_US priority=critical netcfg/choose_interface=em1 netcfg/dhcp_timeout=120 url=tftp://10.0.0.2/preseeds/ubt14043_sda.seed hostname=shandtestG8 domain=spreadtrum.com

ENDTEXT

:wq

mkdir /var/lib/tftpboot/preseeds (该目录下放Ubuntu的seed文件)

DHCP指向文件为bios/pxelinux.0

EFI:

mkdir /var/lib/tftpboot/efi64

cp -rv syslinux-6.03/efi64/efi/syslinux.efi /var/lib/tftpboot/efi64/

cp -rv syslinux-6.03/efi64/com32/elflink/ldlinux/ldlinux.c32 /var/lib/tftpboot/efi64/

cp -rv syslinux-6.03/efi64/com32/lib/libcom32.c32 /var/lib/tftpboot/efi64/

cp -rv syslinux-6.03/efi64/com32/libutil/libutil.c32 /var/lib/tftpboot/efi64/

cp -rv syslinux-6.03/efi64/com32/menu/vesamenu.c32 /var/lib/tftpboot/efi6/

cp -rv syslinux-6.03/efi64/com32/modules/pxechn.c32 /var/lib/tftpboot/efi64/

cp -rv /var/lib/tftpboot/bios/pxelinux.cfg /var/lib/tftpboot/efi64/

DHCP指向文件为efi64/syslinux.efi

mkdir /root/isoubt14043

mount -t iso9660 -o ro,loop ubuntu-14.04.3-server-amd64.iso /root/isoubt14043

mkdir /var/www/html/ks/UBT14043-x86_64 -p

rsync -av --progress /root/isoubt14043/* /var/www/html/ks/UBT14043-x86_64/

Ubuntu preseed文件示例:

d-i live-installer/net-image string http://10.0.0.2/ks/UBT14043-x86_64/install/filesystem.squashfs

d-i debian-installer/locale string en_US.UTF-8

d-i debian-installer/splash boolean false

d-i console-setup/ask_detect boolean false

d-i console-setup/layoutcode string us

d-i console-setup/variantcode string

d-i netcfg/choose_interface select auto

d-i clock-setup/utc boolean true

d-i partman-efi/non_efi_system boolean true

d-i partman-basicfilesystems/choose_label string gpt

d-i partman-basicfilesystems/default_label string gpt

d-i partman-partitioning/choose_label string gpt

d-i partman-partitioning/default_label string gpt

d-i partman/choose_label string gpt

d-i partman/default_label string gpt

d-i partman-auto/method string regular

d-i partman-auto/disk string /dev/sda

d-i partman-auto/expert_recipe select \

boot-root :: \

100000 80 100000 ext4 \

$bootable{ } \

$primary { } \

method{ format } format{ } \

use_filesystem{ } filesystem{ ext4 } \

mountpoint{ / } \

. \

1 1 1 free \

$bios_boot{ } \

$primary { } \

method{ biosgrub } \

. \

2014 538 1075 free \

$primary { } \

method{ efi } format{ } \

mountpoint{ /boot/efi } \

. \

10000 80 10000 linux-swap \

$primary { } \

method{ swap } format{ } \

.

d-i partman-auto/choose_recipe boot-root

d-i partman/confirm_write_new_label boolean true

d-i partman/choose_partition select Finish partitioning and write changes to disk

d-i partman/confirm boolean true

d-i partman/confirm_nooverwrite boolean true

d-i partman/default_filesystem string ext4

d-i clock-setup/utc boolean true

d-i clock-setup/ntp boolean true

d-i clock-setup/ntp-server string 10.0.0.3

d-i base-installer/kernel/image string linux-server

d-i passwd/root-login boolean false

d-i passwd/make-user boolean true

d-i passwd/user-fullname string super

d-i passwd/username string super

d-i passwd/user-password password xxxxx

d-i passwd/user-password-again password xxxxx

d-i user-setup/allow-password-weak boolean true

d-i user-setup/encrypt-home boolean false

d-i passwd/user-default-groups string sudo

d-i mirror/country string manual

d-i mirror/protocol string http

d-i mirror/http/hostname string 10.0.0.2

d-i mirror/http/directory string /ks/UBT14043-x86_64

d-i apt-setup/services-select multiselect security

d-i apt-setup/security_host string 10.0.0.2

d-i apt-setup/security_path string /ks/UBT14043-x86_64

d-i debian-installer/allow_unauthenticated string false

d-i pkgsel/upgrade select none

d-i pkgsel/language-packs multiselect

d-i pkgsel/update-policy select none

d-i pkgsel/updatedb boolean true

d-i grub-installer/skip boolean false

d-i lilo-installer/skip boolean false

d-i grub-installer/only_debian boolean true

d-i grub-installer/with_other_os boolean true

d-i finish-install/keep-consoles boolean false

d-i finish-install/reboot_in_progress note

d-i cdrom-detect/eject boolean true

d-i debian-installer/exit/halt boolean false

d-i debian-installer/exit/poweroff boolean false

d-i pkgsel/include string openssh-server

d-i preseed/late_command string in-target wget -O /root/ipgptefi.sh http://10.0.0.2/ks/UBT14043-x86_64/sh/ipgptefi.sh;in-target sh /root/ipgptefi.sh

 类似资料: