https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview
Edit the file on system boot before put the memory on the raspberry: network-config
Content file:
wifis:
wlan0:
dhcp4: true
optional: true
access-points:
<wifi network name>:
password: "<wifi password>"
sudo netplan --debug try
sudo netplan --debug generate
sudo netplan --debug apply
reboot
sudo apt update -y
sudo apt upgrade -y
sudo apt install openssh-server -y
sudo service ssh enable