I was trying to get the WIFI working on my Raspberry PI 3 with Ubuntu Server 18.04 LTS, after some time researching I found a way to get it right:
First, we need to update everything just because. Don’t ask.
sudo apt update
sudo apt full-upgrade
We are going to use “net-plan” so we must run the following commands:
cd /etc/netplan/
sudo cp 50-cloud-init.yaml 50-cloud-init.yaml.bak
sudo nano 50-cloud-init.yaml
Now that we have edit the file, we are going to add the following at the bottom:
wifis:
wlan0:
optional: true
access-points:
"ssid-here":
password: "password-here"
dhcp4: true
You can test the configuration by executing:
sudo netplan --debug try
sudo netplan --debug generate # This one is going to give you more information about the issue, if there any.
If there is no issue in the output, then apply the configuration
sudo netplan --debug apply
Now, please reboot the Raspberry Pi 3 and it should boot connecting to the WIFI.