Fedora 26: Install PXE Boot server for thin client with NFS

Table of Contents

1 Install PXE Boot server

The following script will install PXE Boot server. Change the variables to your environment.

  • SERVER_IPADDR is IP adress of PXE Boot server.
  • DHCP_SERVER_INTERFACESv4 is network interface name for DHCP. DHCP will be provided via this network interface.
  • DHCP_SUBNET is network address for DHCP.
  • DHCP_NETMASK is subnet for DHCP.
  • DHCP_DNS is DNS for DHCP.
  • DHCP_ROUTER is gateway for DHCP.
  • DHCP_CLIENT_HOSTNAME is hostname of client.
  • DHCP_CLIENT_IPADDR is IP address of client.
  • DHCP_CLIENT_MACADDR is MAC address of client.

NFS root filesystem is set to the following.

  • Set root user password to “fedora”.
  • Create user which name is “fedora” and password is “fedora”.

#!/bin/shset -e# Change the following variable to yours.[ -z “${SERVER_IPADDR}” ] && SERVER_IPADDR=$(hostname -I | awk ‘{ print $1 }’)[ -z “${DHCP_SUBNET}” ] && DHCP_SUBNET=[ -z “${DHCP_NETMASK}” ] && DHCP_NETMASK=[ -z “${DHCP_DOMAIN}” ] && DHCP_DOMAIN=hiroom2.com[ -z “${DHCP_DNS}” ] && DHCP_DNS=”,″[ -z “${DHCP_ROUTER}” ] && DHCP_ROUTER=[ -z “${DHCP_CLIENT_HOSTNAME}” ] && DHCP_CLIENT_HOSTNAME=fedora-26-pxeboot-client[ -z “${DHCP_CLIENT_IPADDR}” ] && DHCP_CLIENT_IPADDR=[ -z “${DHCP_CLIENT_MACADDR}” ] && DHCP_CLIENT_MACADDR=52:54:00:5e:7a:a4if [ -z “${MIRROR_URL}” ]; then F26=https://dl.fedoraproject.org/pub/fedora/linux/releases/26 MIRROR_URL=${F26}/Everything/x86_64/os/fitftp_server_install(){ sudo dnf install -y tftp-server sudo firewall-cmd –add-service=tftp –permanent sudo firewall-cmd –reload sudo systemctl enable tftp sudo systemctl restart tftp}dhcp_install(){ sudo dnf install -y dhcp cat <<EOF | sudo tee /etc/dhcp/dhcpd.confsubnet ${DHCP_SUBNET} netmask ${DHCP_NETMASK} { option domain-name “${DHCP_DOMAIN}”; option domain-name-servers ${DHCP_DNS}; option routers ${DHCP_ROUTER}; next-server ${SERVER_IPADDR}; filename “pxelinux.0”;}host ${DHCP_CLIENT_HOSTNAME} { hardware ethernet ${DHCP_CLIENT_MACADDR}; fixed-address ${DHCP_CLIENT_IPADDR};}EOF sudo firewall-cmd –add-service=dhcp –permanent sudo firewall-cmd –reload sudo systemctl enable dhcpd sudo systemctl restart dhcpd}nfs_utils_install(){ sudo dnf install -y nfs-utils sudo firewall-cmd –add-service=nfs –permanent sudo firewall-cmd –reload sudo systemctl enable nfs sudo systemctl restart nfs sudo mkdir /var/lib/nfsroot cat <<EOF | sudo tee /etc/exports/var/lib/nfsroot *(rw,sync,no_root_squash,no_subtree_check)EOF sudo exportfs -ra sudo mkdir /var/lib/nfsroot/proc sudo mount -o bind /proc /var/lib/nfsroot/proc # shellcheck disable=SC2086 sudo dnf group install -y –releasever=25 –installroot=/var/lib/nfsroot “Fedora Workstation” # https://bugzilla.redhat.com/show_bug.cgi?id=1374427 sudo restorecon /var/lib/nfsroot/etc/passwd* /var/lib/nfsroot/usr/bin/passwd sudo systemd-nspawn -D /var/lib/nfsroot sh -c “# Set root password and create user.yes fedora | passwduseradd -m -s /bin/bash fedorayes fedora | passwd fedora# Locale setting.echo LANG=”en_US.UTF-8″ | tee /etc/locale.conf”}syslinux_install(){ sudo dnf install -y syslinux cd /var/lib/tftpboot sudo cp /usr/share/syslinux/pxelinux.0 . sudo cp -a /usr/share/syslinux . sudo wget -q ${MIRROR_URL}/isolinux/initrd.img sudo wget -q ${MIRROR_URL}/isolinux/vmlinuz sudo mkdir pxelinux.cfg cat <<EOF | sudo tee pxelinux.cfg/defaultpath syslinuxinclude menu.cfgdefault syslinux/vesamenu.c32prompt 0timeout 10EOF cat <<EOF | sudo tee menu.cfgmenu hshift 13menu width 49menu margin 8menu tabmsgmenu title Thin client boot menulabel fedora-26-thin-client menu label ^Fedora 26 thin client kernel vmlinuz append vga=788 initrd=initrd.img ip=dhcp root=/dev/nfs nfsroot=${SERVER_IPADDR}:/var/lib/nfsroot rw selinux=0menu endEOF}pxeboot_main(){ tftp_server_install dhcp_install nfs_utils_install syslinux_install}pxeboot_main

2 Run Fedora 26 thin client with NFS

This article runs Fedora 26 thin client on virtual machine on KVM. Virtual machine on VirtualBox and real machine too can run Fedora 26 thin client with enabling network boot. Please check your BIOS setting.

Enable “NIC” of “Boot device order” and make it top of order with virt-manager.


iPXE sends DHCP requests, receives DHCP response from PXE Boot server, download and run boot image.


syslinux’s menu is displayed. After 1 second, “Fedora 26 thin client” will be selected automatically.


Fedora 26 thin client is started.


Login is displayed.


Android | Linux | SDL - Narrow Escape