Whether you need to install your Raspberry Pi headless,
Or whether you plan to mass-produce SD card for a big IoT project,
In both case, Ubuntu offer a very standard way to pre-configure your image, based on Cloud-init.
(Re)mount your SD card volume, then you have acces to the two files we will update:
network-config. Cloud-init is a de facto standard for Cloud VM configuration. You can do pretty everything with it.
You can find below my own configuration file, which:
- set a hostname
- set a (default) user
piwith an authorized public ssh key and sudo rights
network-config relies on Netplan format (reference).
The default configuration of the Ubuntu pre-installed image enables network on the ethernet port, using DHCP:
For example, if you want to enable both ethernet and wifi, update the file accordingly: