#!/bin/bash # Prepare diskless NFS Debian Buster with tmpfs overlay # The idea is just to boot a node and expose SSH # NFS export is /home/nfsboot # TFTP root is /home/tftp set -e SERVER=172.31.1.5 SUBNET=172.31.1.0/24 CFG=`dirname $0`/debian_nfs.conf [ -f "$CFG" ] && . $CFG apt-get -y install pxelinux syslinux-common nfs-kernel-server dnsmasq echo "/home/nfsboot $SUBNET(ro,no_root_squash)" >> /etc/exports service nfs-kernel-server restart service rpcbind restart cat >/etc/dnsmasq.conf < /etc/hostname ln -s /proc/mounts /etc/mtab echo 'deb http://http.debian.net/debian buster main contrib non-free' > /etc/apt/sources.list echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf echo en_US.UTF-8 UTF-8 > /etc/locale.gen echo ru_RU.UTF-8 UTF-8 >> /etc/locale.gen apt-get update apt-get install -y network-manager mc less git wget ca-certificates linux-cpupower iperf3 \ zip unzip curl smartmontools hdparm fio pciutils usbutils python3 bzip2 dosfstools grub-efi-amd64 \ xz-utils file debootstrap ethtool nvme-cli openssh-server locales nfs-common \ linux-image-amd64 firmware-linux firmware-linux-nonfree \ firmware-amd-graphics firmware-realtek firmware-bnx2 firmware-bnx2x busybox echo '/dev/nfs / nfs tcp,nolock,ro,soft 0 0' > /etc/fstab echo 'tmpfs /tmp tmpfs defaults 0 0' >> /etc/fstab rm -rf /var/tmp ln -s /tmp /var/tmp if ! grep -q "^overlay" /etc/initramfs-tools/modules; then echo overlay >> /etc/initramfs-tools/modules fi cat >/etc/initramfs-tools/initramfs.conf </etc/rc.local <pxelinux.cfg/default <