To configure WiFi connection in the Raspberry Pi desktop-less environment, we can do this by editing the following files:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
In the file you can add the following to configure your WiFi network:
country=china
ctrl_interface=/var/run/wpa_supplicant
update_config=1
network={
ssid="Wifi_SSID"
psk="Wifi_Password"
}
- Replace
Wifi_SSID
with the actual network name - will be
Wifi_Password
replaced with the actual WiFi password
After the modification is completed, save and exit the file, and restart the network service to make it effective immediately.
sudo systemctl restart networking
You can also restart the system directly
sudo reboot
The Raspberry Pi will connect to the WiFi network using the configuration you provide. Please make sure your WiFi network name and password are correct and that the Pi and WiFi router are close enough to get good signal strength.