Raspberry Pi – how to setup Wifi WPA2-PSK

The configs below also set a manual IP at 192.168.1.60.

/etc/network/interfaces:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
address 192.168.1.60 # change it to the static IP that you want.
netmask 255.255.255.0
gateway 192.168.1.1
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

/etc/wpa_supplicant/wpa_supplicant.conf:

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

network={
ssid="replace_with_your_ssid"
psk="replace_with_your_password"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
auth_alg=OPEN
}

Then I installed wicd and wicd-curses with the following commands:

sudo apt-get install wicd
sudo apt-get install wicd-curses

Run wicd-curses at the command line and setup your wireless network and let it automatically connect to this network on startup.

wicd-curses

-> Select wifi

-> C for config

-> Select the option to use this wi-fi at boot time to connect

-> C (Connect)

-> Save

Reboot and I was able to connect to my wireless network.