How to configure PXE Network Boot Server for  Ubuntu 18.04 Server
Channel: Heikki Koivisto
Date: 2019-09-16

Continue to Pxe series and create server which provide PXE boot environment to Ubuntu 18.04 server. 
Support channel: https://www.youtube.com/c/HeikkiKoivisto/?sub_confirmation=1
Prequired packages for pxe installation Ubuntu 18.04 SERVER

apt install dnsmasq apache2

Autostart apache2 and dnsmasq
systemctl enable apache2
systemctl enable dnsmasq 

Move original dnsmasq conf to backup

mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup

Edit dnsmasq conf

nano /etc/dnsmasq.conf

interface=enp0s3 #enp0s8
bind-interfaces
domain=koti.local

dhcp-range=enp0s3,192.168.100.100,192.168.100.240,255.255.255.0,8h
dhcp-option=option:router,192.168.100.1
dhcp-option=option:dns-server,192.168.100.1
dhcp-option=option:dns-server,8.8.8.8
 
enable-tftp
tftp-root=/srv/tftp
dhcp-boot=pxelinux.0,linuxhint-s20,192.168.100.26
pxe-prompt="Press F8 for PXE Network boot.", 2
pxe-service=x86PC, "Install OS via PXE",pxelinux

Create folder for tftp
mkdir /srv/tftp

Restart dnsmasq service
systemctl restart dnsmasq.service

Download Ubuntu 18.04 LTS server ISO file or move it... - not live cd !!!!!!!!!!!!
wget http://releases.ubuntu.com/18.04/ubut.iso  

old iso http://old-releases.ubuntu.com/releases/18.04.1/ubuntu-18.04.2-server-amd64.iso
 
Mount iso image
mount -o loop file.iso /mnt/

Copy netboot - folder to tftp folder
cp -rf /mnt/install/netboot/* /srv/tftp/

Remember open firewall! (53/tcp/udp,67/udp,69/udp,80/tcp,4011/udp)

Copy/create http content
cp -rf /mnt/* /var/www/html

Create local preseed file
nano /var/www/html/ubuntu/preseed/local-sources.seed

d-i live-installer/net-image string http://192.168.100.26/ubuntu/install/filesystem.squashfs

### Localization
# Locale sets language and country.
d-i debian-installer/locale string CHANGETHISLOCALE
d-i pkgsel/install-language-support boolean false
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string fi

### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/dhcp_timeout string 60
d-i netcfg/dhcp_failed note
d-i netcfg/get_hostname string unassigned-hostname
d-i netcfg/get_domain string unassigned-domain


### Mirror settings
d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string 192.168.100.26
d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string


### Clock and time zone setup
d-i clock-setup/utc boolean true

# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Europe/Helsinki

d-i clock-setup/ntp boolean false

### Partitioning
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman/default_filesystem string ext4

d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

### Account setup
# To create a normal user account.
d-i passwd/user-fullname string de
d-i passwd/username string de
d-i passwd/user-password password 123
d-i passwd/user-password-again password 123
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false

### Apt setup
tasksel tasksel/first multiselect ubuntu-desktop
# Individual additional packages to install
d-i pkgsel/include string openssh-server build-essential

### Boot loader installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true

### Finishing up the installation
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/poweroff boolean true

### X configuration
# Monitor autodetection is recommended.
xserver-xorg xserver-xorg/autodetect_monitor boolean true
xserver-xorg xserver-xorg/config/monitor/selection-method \
       select medium
xserver-xorg xserver-xorg/config/monitor/mode-list \
       select 1024x768 @ 60 Hz

ubiquity ubiquity/summary note

Create boot menu:
nano /srv/tftp/ubuntu-installer/amd64/boot-screens/txt.cfg

default install
label install
 menu label ^Install Ubuntu 18.04 with Local Sources
 menu default
 kernel ubuntu-installer/amd64/linux
 append auto=true url=http://192.168.100.26/ubuntu/preseed/local-sources.seed vga=788 initrd=ubuntu-installer/amd64/initrd.gz --- quiet 
label cli
 menu label ^Command-line install
 kernel ubuntu-installer/amd64/linux
 append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=788 initrd=ubuntu-installer/amd64/initrd.gz --- quiet

Finally edit meny.cfg
nano /srv/tftp/ubuntu-installer/amd64/boot-screens/menu.cfg

#menu hshift 13
#menu width 49
#menu margin 8