This method is not netinst. The ISO is downloaded from a URL into RAM, and mounted. After that, installation proceeds exactly as if it was a pen drive / CDROM, and the network cable can be disconnected if you want.
You do not need internet in either computer, just the ISO file.
We don't touch any system files, just delete $TFTPROOT
and dnsmasq.conf
when you're done.
Make sure 7z and dnsmasq are installed. Download your Ubuntu ISO somewhere.
You'll also need syslinux and its modules:
apt install syslinux-common
# or
pacman -S syslinux
-
Set variables for the following commands (examples shown here):
INTERFACE=eth0 ISOPATH=/tmp/ubuntu-20.04.2-desktop-amd64.iso TFTPROOT=/tmp/tftp cd /tmp
-
Prepare TFTP root: syslinux + ldlinux module, and the kernel + initrd from the ISO
mkdir -p $TFTPROOT cp /usr/lib/syslinux/efi64/{syslinux.efi,ldlinux.e64} $TFTPROOT 7z x $ISOPATH casper/{vmlinuz,initrd} -o$TFTPROOT
-
Create configuration file for syslinux:
- boot kernel + initrd with the same command line (look at
boot/grub/grub.cfg
in the ISO file) - add
ip=dhcp url=<URL>
to tell it to download the ISO through HTTP
mkdir -p $TFTPROOT/pxelinux.cfg echo " DEFAULT install LABEL install KERNEL casper/vmlinuz INITRD casper/initrd APPEND ip=dhcp url=http://192.168.4.1:8111/ubuntu.iso root=/dev/ram0 ramdisk_size=1500000 file=/cdrom/preseed/ubuntu.seed maybe-ubiquity quiet splash " > $TFTPROOT/pxelinux.cfg/default
- boot kernel + initrd with the same command line (look at
-
Start HTTP server to provide the ISO file:
ln -s $ISOPATH $TFTPROOT/ubuntu.iso python3 -m http.server 8111 -d $TFTPROOT &
-
Start DHCP+TFTP server that boots
syslinux.efi
:echo " bind-interfaces listen-address=192.168.4.1 dhcp-range=192.168.4.100,192.168.4.200 dhcp-boot=syslinux.efi enable-tftp tftp-root=$TFTPROOT " > dnsmasq.conf nmcli dev set $INTERFACE managed no # <-- if you're using NetworkManager, make sure it won't mess with the interface sudo ip address add dev $INTERFACE 192.168.4.1/24 sudo ip link set dev $INTERFACE up sudo dnsmasq -C dnsmasq.conf -l dhcp.leases -d &
Boot the other computer by network (remember to disable Secure Boot first).
-
I've only tested the Desktop version, but works with server (in fact this is adapted from a Ubuntu Server guide).
-
If you want to use legacy BIOS instead of UEFI, you only need to change the following (more info):
/usr/lib/syslinux/bios/{pxelinux.0,ldlinux.c32}
instead of/usr/lib/syslinux/efi64/{syslinux.efi,ldlinux.e64}
dhcp-boot=pxelinux.0
instead ofdhcp-boot=syslinux.efi
-
Ubuntu installers (their initrd) support this mode of installation through the
url
argument, but I don't know what other distributions support it.