To set up wifi (WPA/WPA2 Only) on the Pi, I was able to get the following working with my setup. Other instructions (including the ones adding the directives to /etc/network/interfaces) didn’t work for me.

I just installed Raspbian on a Pi today (2015-01-02), so these instructions should be current. My /etc/network/interfaces file already had the following in it (if yours doesn’t, then put these lines in so it looks the same):

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Then, edit /etc/wpa_supplicant/wpa_supplicant.conf and add the following onto the end of the file:

network={
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
}
sudo ifdown wlan0
sudo ifup wlan0