Generate passphrase:
wpa_passphrase <myssid> <mypassword> > /etc/wpa_supplicant.conf
Edit /etc/network/interfaces:
auto <wireless-interface> iface <wireless-interface> inet static address 10.1.1.10 netmask 255.255.255.0 wireless-essid <myssid> gateway 10.1.1.1 post-up wpa_supplicant wpa_supplicant -B -Dnl80211 -i<wireless-interface> -c/etc/wpa_supplicant.conf post-down killall -q wpa_supplicant dns-nameservers 8.8.8.8
Here you need to find out your wifi adapter’s driver using wpa_supplicant –help. In my case it is nl80211 but yours may be different.