For WPA Wifi, edit the file /etc/wpa_supplicant/wpa_supplicant.conf as root.

Example:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=FR

network={
	ssid="MY_SSID"
	psk="MY_PASSWORD"
	key_mgmt=WPA-PSK
}

Replace MY_SSID by the name of the Wifi network and MY_PASSWORD by the password of the Wifi network.

Multiple networks can be declared, the one with higher priority will be used if possible:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=FR

network={
	ssid="MY_SSID"
	psk="MY_PASSWORD"
	key_mgmt=WPA-PSK
	priority=1
}

network={
	ssid="MY_SSID2"
	psk="MY_PASSWORD2"
	key_mgmt=WPA-PSK
	priority=2
}