This is a set of steps that will create a custom image of Ubuntu Server which can then be deployed to a Raspberry Pi 4 without a monitor. Please be sure you understand each command before running it. firefox https://ubuntu.com/download/raspberry-pi xzcat ubu*.img.xz > custom.img & progress -mp$! mkdir -p /mnt/rpi; losetup -f custom.img; losetup | grep custom.img partprobe /dev/loop??? mount /dev/loop???p2 /mnt/rpi; mount /dev/loop???p1 /mnt/rpi/boot sudo -i; cd /mnt/rpi; mkdir root/.ssh; chmod 777 root/.ssh cp -p /root/.ssh/{authorized_keys,config,known_hosts} root/.ssh # sed -i 's/motd=.*/noupdate/' etc/pam.d/login # sed -i 's/1/0/' etc/apt/apt.conf.d/20auto-upgrades cat > etc/netplan/99-network.yaml << EoT #network: # version: 2 # renderer: networkd # ethernets: # eth0: # dhcp4: false # addresses: # - 192.168.1.12/24 # gateway4: 192.168.1.1 # nameservers: # search: [domain.tld] # addresses: [8.8.8.8, 8.8.6.6] EoT vi etc/netplan/99-network.yaml # sed -i '$aNTP=ntp.domain.tld 192.168.1.1' etc/systemd/timesyncd.conf cat > root/.aliases << EoT unalias -a export EDITOR=vim VISUAL=vim export PAGER=less LESS="-FMq" export HISTCONTROL="erasedups:ignorespace" alias .a="vim ~/.aliases.local; . ~/.aliases.local" alias .au=". ~/.aliases" alias vi="vim" EoT ln -s .aliases root/.bash_aliases ln -sf /usr/share/zoneinfo/EST5EDT etc/localtime echo "myname.domain.tld" > etc/hostname touch boot/ssh echo "hdmi_enable_4kp60=1" >> boot/config.txt cat > boot/wpa_supplicant.conf < /dev/device' | sudo sh # boot the pi with the new image usermod -L ubuntu; chage -E 1 ubuntu; passwd root