# pxe # pxe ```bash apt install syslinux pxelinux tftpd-hpa nfs-kernel-server lighttpd -y ``` ```bash vim /etc/default/tftpd-hpa ``` ```bash TFTP_OPTIONS="--secure --ipv4" ``` ```bash mkdir --p /netboot/tftp/pxelinux.cfg mkdir -p /netboot/pxe/configs mkdir -p /netboot/pxe/data chmod -R 777 /netboot/pxe chown -R www-data:www-data pxe ``` ```bash ssh-keygen ``` ```bash cp ~/.ssh/id_rsa.pub /netboot/pxe/sshkeys.pub ``` ```bash mkdir -p /netboot/nfs/ ``` ```bash vim /etc/exports ``` ```bash /netboot/nfs/ *(ro,sync,no_wdelay,insecure_locks,no_root_squash,insecure,no_subtree_check) ``` ```bash exportfs -a ``` ```bash echo "Setting up NFS for local network" echo "/netboot/pxe 10.0.9.0/255.255.255.0(rw,sync,no_root_squash,no_subtree_check)" >> /etc/exports echo "Restarting NFS service" exportfs -ra ``` ```bash vim /etc/lighttpd/lighttpd.conf ``` ```bash server.document-root = "/netboot/pxe" dir-listing.activate = "enable" ``` ```bash service lighttpd restart ``` ```bash cd /netboot/pxe/ wget http://nl.alpinelinux.org/alpine/v3.9/releases/x86_64/netboot/vmlinuz-vanilla wget http://nl.alpinelinux.org/alpine/v3.9/releases/x86_64/netboot/modloop-vanilla wget http://nl.alpinelinux.org/alpine/v3.9/releases/x86_64/netboot/initramfs-vanilla ``` ```bash cp -v /usr/lib/PXELINUX/pxelinux.0 /netboot/tftp/ ``` ```bash cp -v /usr/lib/syslinux/modules/bios/{ldlinux.c32,libcom32.c32,libutil.c32,vesamenu.c32} /netboot/tftp/ ``` ```bash touch /netboot/tftp/pxelinux.cfg/default ``` ```bash vim /netboot/tfpt/pxelinux.cfg/default ``` ```bash DEFAULT vesamenu.c32 PROMPT 0 TIMEOUT 300 MENU TITLE PXE Network Boot Menu LABEL local MENU LABEL Von Festplatte starten MENU DEFAULT LOCALBOOT 0 LABEL memtest MENU LABEL Speichertest mit memtest86+ v4.20 KERNEL memtest ``` ```bash wget http://releases.ubuntu.com/18.04/ubuntu-18.04.3-desktop-amd64.iso ``` ```bash mount -o loop ubuntu-18.04.3-desktop-amd64.iso /mnt ``` ```bash mkdir -v /netboot/{nfs,tftp}/ubuntu1804 ``` ```bash cp -Rfv /mnt/* /netboot/nfs/ubuntu1804/ ``` ```bash cp -v /mnt/casper/{vmlinuz,initrd} /netboot/tftp/ubuntu1804/ ``` ```bash chmod -Rfv 777 /netboot ``` ```bash umount /mnt ``` ```bash rm ubuntu-18.04.3-desktop-amd64.iso ``` ```bash vim /netboot/tftp/pxelinux.cfg/default ``` ```bash default vesamenu.c32 label install1 menu label ^Install Ubuntu 18.04 LTS Desktop menu default kernel ubuntu1804/vmlinuz append initrd=ubuntu1804/initrd boot=casper netboot=nfs nfsroot=super41.home:/ netboot/nfs/ubuntu1804/ splash toram --- ``` [pxe](https://linuxhint.com/pxe_boot_ubuntu_server/)[alpine](https://blog.haschek.at/2019/build-your-own-datacenter-with-pxe-and-alpine.html)